Skip to content

Commit

Permalink
check-before-deployment: add info about chronyd/chronyc on CentOS 8 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jul 8, 2021
1 parent 7ec8e1f commit 5a2c576
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions check-before-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ TiDB 是一套分布式数据库系统,需要节点间保证时间的同步,
Active: active (running) since 一 2017-12-18 13:13:19 CST; 3s ago
```

- 若返回报错信息 `Unit ntpd.service could not be found.`,请尝试执行以下命令,以查看与 NTP 进行时钟同步所使用的系统配置是 `chronyd` 还是 `ntpd`

{{< copyable "shell-regular" >}}

```bash
sudo systemctl status cronyd.service
```

```
chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-04-05 09:55:29 EDT; 3 days ago
```

如果你使用的系统配置是 `chronyd`,请直接执行以下的步骤 3。

2. 执行 `ntpstat` 命令检测是否与 NTP 服务器同步:

> **注意:**
Expand Down Expand Up @@ -209,6 +225,48 @@ TiDB 是一套分布式数据库系统,需要节点间保证时间的同步,
Unable to talk to NTP daemon. Is it running?
```

3. 执行 `chronyc tracking` 命令查看 Chrony 服务是否与 NTP 服务器同步。

> **注意:**
>
> 该操作仅适用于使用 Chrony 的系统,不适用于使用 NTPd 的系统。

{{< copyable "shell-regular" >}}

```bash
chronyc tracking
```

- 如果该命令返回结果为 `Leap status : Normal`,则代表同步过程正常。

```
Reference ID : 5EC69F0A (ntp1.time.nl)
Stratum : 2
Ref time (UTC) : Thu May 20 15:19:08 2021
System time : 0.000022151 seconds slow of NTP time
Last offset : -0.000041040 seconds
RMS offset : 0.000053422 seconds
Frequency : 2.286 ppm slow
Residual freq : -0.000 ppm
Skew : 0.012 ppm
Root delay : 0.012706812 seconds
Root dispersion : 0.000430042 seconds
Update interval : 1029.8 seconds
Leap status : Normal
```

- 如果该命令返回结果如下,则表示同步过程出错:

```
Leap status : Not synchronised
```

- 如果该命令返回结果如下,则表示 Chrony 服务未正常运行:

```
506 Cannot talk to daemon
```

如果要使 NTP 服务尽快开始同步,执行以下命令。可以将 `pool.ntp.org` 替换为你的 NTP 服务器:

{{< copyable "shell-regular" >}}
Expand Down

0 comments on commit 5a2c576

Please sign in to comment.