两台服务器测试环境
master:192.168.1.10/centos7
node:192.168.1.11/centos7
节点都安装chrony服务
[root@master ~]# yum -y install chrony
[root@node ~]# yum -y install chrony
master节点配置
[root@master etc]# vim /etc/chrony.conf
修改配置文件,注释所有默认时间服务器
添加服务器为master本机
允许所有节点同步
[root@master etc]# systemctl enable chronyd
[root@master etc]# systemctl restart chronyd
[root@master etc]# timedatectl set-ntp true
#重启 chronyd 服务并设为开机启动,开启网络时间同步功能
node节点配置
[root@node ~]# vim /etc/chrony.conf
修改时间服务器为master的ip地址即可
[root@node ~]# systemctl enable chronyd
[root@node ~]# systemctl restart chronyd
使用chronyc sources命令查询结果,如下已经完成同步
chronyc sources
chronyc sources
看到 * 符号就代表客户端已经正常与时间服务器进行时间同步。
注:本文转自https://developer.aliyun.com/article/799761?spm=a2c6h.13813017.content3.1.33085d07bGzyiL
这个网站像一个笔记本,记录博主遇到的点点滴滴的技术难题