Chronyd

chronyd是一个同步系统时钟的守护进程。

从Centos7开始默认安装时钟同步服务chronyd,而不是ntpd。

1# dnf -y install chronyd
2# eccho 'server ntp1.aliyun.com iburst' >> /etc/chrony.conf
3# systemctl enable chronyd.service && systemctl start chronyd.service

Chronyc

chronyc is a command-line interface program which can be used to monitor chronyd’s performance and to change various operating parameters whilst it is running.

 1# chronyc sources -v
 2  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 3 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
 4| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
 5||                                                 .- xxxx [ yyyy ] +/- zzzz
 6||      Reachability register (octal) -.           |  xxxx = adjusted offset,
 7||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
 8||                                \     |          |  zzzz = estimated error.
 9||                                 |    |           \
10MS Name/IP address         Stratum Poll Reach LastRx Last sample               
11===============================================================================
12^* classroom.example.com         8  10   377  1000   +130us[ +147us] +/-  819us

createTime: 2022-01-05T14:51:19+08:00
updateTime: 2022-01-05T14:51:19+08:00

createTime: 2022-01-05T14:51:19+08:00
updateTime: 2022-01-05T14:51:19+08:00

set-timezone

  • 设置时区,也可以手动执行localtime软连接
1createTime: 2022-01-05T14:51:19+08:00
2updateTime: 2022-01-05T14:51:19+08:00
3ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

set-ntp BOOL

  和chrony配置的ntp server进行时间同步

set-time TIME

  手动设置日期时间