Centos 7 安装 Chronyd 做时间同步
  a2YSDg6MLa2F 2023年11月02日 30 0


Centos 7 安装 Chronyd 做时间同步

  • ​​1. yum 安装 Chronyd​​
  • ​​2. 设置开机启动:​​
  • ​​3. server配置​​
  • ​​4. client配置​​
  • ​​5. 重启、查看时间同步情况​​

1. yum 安装 Chronyd

正常情况下,Centos 7.x 之后,都已经默认安装过 Chronyd 的,但是今天遇到一个奇怪的问题,客户环境的ARM服务器,集群时间不同步了,然后看了下,没有安装这个鬼东西。

由于临时给开了网络,这里直接使用 yum 安装 Chronyd :​​yum install chrony -y​

Centos 7 安装 Chronyd 做时间同步_centos

2. 设置开机启动:

systemctl start chronyd
systemctl enable chronyd

3. server配置

这里选取集群中的一台作为server服务端,当前机器内网IP为:​​172.16.101.188​​​,​​vim /etc/chrony.conf​​ 修改以下两项

Centos 7 安装 Chronyd 做时间同步_chrony_02

# Allow NTP client access from local network.  允许所有主机从server端同步时间
allow all

# Serve time even if not synchronized to a time source. 即使server端无法从互联网同步时间,也同步本机时间至client
local stratum 10

4. client配置

​vim /etc/chrony.conf​​ 注释原server配置,改为 server 机器 IP 地址

Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 172.16.101.188 iburst

5. 重启、查看时间同步情况

重启命令:​​systemctl restart chronyd​

查看server端在线情况和时间同步情况: ​​chronyc activity​​​、​​chronyc tracking​

Centos 7 安装 Chronyd 做时间同步_服务器_03


查看 client 端在线情况和时间同步情况: ​​chronyc activity​​​、​​chronyc tracking​

Centos 7 安装 Chronyd 做时间同步_时间同步_04


可以看到,时间已经同步了。


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  9E2BTpjt8nym   2023年12月06日   34   0   0 WindowsgitCentOS
a2YSDg6MLa2F