首页 > 系统相关 >Centos 7 安装 Chronyd 做时间同步

Centos 7 安装 Chronyd 做时间同步

时间:2022-12-02 15:38:11浏览次数:42  
标签:同步 Chronyd Centos ntp server org pool


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 做时间同步_chrony

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 做时间同步_chrony_04


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


标签:同步,Chronyd,Centos,ntp,server,org,pool
From: https://blog.51cto.com/linmengmeng/5907054

相关文章