chronyd时间同步
systemctl status chronyd 查看状态
systemctl start chronyd 启动服务
检查chrony同步状态
[root@Prometheus-APM ~]# chronyc tracking
Reference ID : 0A880A65 (10.136.10.101)
Stratum : 3
Ref time (UTC) : Wed Aug 24 09:24:58 2022
System time : 0.000000538 seconds fast of NTP time
Last offset : -0.000534469 seconds
RMS offset : 0.000534469 seconds
Frequency : 0.000 ppm slow
Residual freq : -1396.281 ppm
Skew : 1000000.000 ppm
Root delay : 0.015808206 seconds
Root dispersion : 12.424818993 seconds
Update interval : 2.0 seconds
Leap status : Normal
[root@Prometheus-APM ~]#
Leap status: 可能值为Normal、Insert second、Delete second、Not synchronized
Leap status : Normal 为正常, Leap status : Not synchronised 为异常,需要检查是否能正常同步到时钟源
手动临时同步时钟源,前提是chronyd服务未开启 chronyd -q 'server ntp1.aliyun.com iburst' 说明:iburst --表示尽快同步
临时同步需要先关掉服务,systemctl stop chronyd,否则报错,Fatal error : Another chronyd may already be running
[root@Prometheus-APM ~]# chronyd -q 'server ntp1.aliyun.com iburst'
2022-08-24T09:19:17Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
2022-08-24T09:19:17Z Fatal error : Another chronyd may already be running (pid=1791556), check /var/run/chrony/chronyd.pid
[root@Prometheus-APM ~]# systemctl stop chronyd
[root@Prometheus-APM ~]# chronyd -q 'server ntp1.aliyun.com iburst'
2022-08-24T09:19:30Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
2022-08-24T09:19:40Z No suitable source for synchronisation
2022-08-24T09:19:40Z chronyd exiting
No suitable source for synchronisation 表示同步异常了,正常情况如下
[root@Prometheus-APM ~]# chronyd -q 'server ntp1.aliyun.com iburst'
2022-08-24T09:24:13Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
2022-08-24T09:24:17Z System clock wrong by -58.289906 seconds (step)
2022-08-24T09:23:19Z chronyd exiting