CentOS安装时钟同步服务

2022-02-15 12:42:16 浏览数 (3)

CentOS安装时钟同步服务

使用chrony用于时间同步

代码语言:javascript复制
yum install chrony -y

vim /etc/chrony.conf

cat /etc/chrony.conf | grep -v  "^#" | grep -v "^$"
pool ntp.aliyun.com iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
allow 10.0.0.0/8
local stratum 10
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony


systemctl restart chronyd
systemctl enable chronyd
复制代码

客户端安装并配置

代码语言:javascript复制
yum install chrony -y

vim /etc/chrony.conf

cat /etc/chrony.conf | grep -v  "^#" | grep -v "^$"
pool 10.0.0.20 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony

systemctl restart chronyd ; systemctl enable chronyd
复制代码

使用客户端进行验证

代码语言:javascript复制
chronyc sources -v


  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, ' ' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- 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               
===============================================================================
^* master01                      3   6    17     7  -2539ns[  -29us]  /-   16ms


复制代码

www.oiox.cn/

www.chenby.cn/

cby-chen.github.io/

weibo.com/u/598247412…

blog.csdn.net/qq_3392175…

my.oschina.net/u/3981543

www.zhihu.com/people/chen…

segmentfault.com/u/hppyvyv6/…

juejin.cn/user/331578…

space.bilibili.com/352476552/a…

cloud.tencent.com/developer/c…

www.jianshu.com/u/0f894314a…

www.toutiao.com/c/user/toke…

CSDN、GitHub、知乎、开源中国、思否、掘金、简书、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、全网可搜《小陈运维》

0 人点赞