[CentOS7]chrony 时间同步


参考文献

https://docs.fedoraproject.org/en-US/Fedora/18/html/System_Administrators_Guide/sect-Checking_if_chrony_is_synchronized.html

安装

yum install -y chrony

修改配置文件

cp /etc/chrony.conf /etc/chrony.conf.bak
sed -i '/^server/d' /etc/chrony.conf
sed -i '2a server ntp1.aliyun.com' /etc/chrony.conf
sed -i '2a server ntp2.aliyun.com' /etc/chrony.conf
sed -i '2a server ntp3.aliyun.com iburst\nallow 10/8' /etc/chrony.conf

启动服务

systemctl start chronyd && systemctl enable chronyd

设置时区

timedatectl set-timezone Asia/Shanghai

查看时间源

[root@ntp ~]# chronyc sources -v
210 Number of sources = 2

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 203.107.6.88                  2   6    17    38   -883us[-2553us] +/-   20ms
^? 120.25.115.20                 2   6     1    44   +624us[-3946ms] +/-   25ms

强制更新时间

chronyc -a makestep

END


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM