1.集群中所有节点安装ntp,
yum install ntp2.所有节点设置时区,这里设置为中国所用时间timedatectl set-timezone Asia/Shanghai
3. 在server节点上启动ntp服务
systemctl start ntpd
systemctl enable ntpd 4.在server节点上设置现在的准确时间 timedatectl set-time HH:MM:SS
5.在server节点上设置其ntp服务器为其自身,同时设置可以接受连接服务的客户端。修改/etc/ntp.conf,添加两行:
restrict 127.0.0.1
server 127.127.1.06.重启ntpd服务
systemctl restart ntpd 7.在client节点上设置ntp服务器为server节点。修改/etc/ntp.conf,添加一行:
server (server的IP地址)8.在client节点上同步server的时间,
ntpdate (server IP) 9. client节点启动ntpd服务
systemctl start ntpd
systemctl enable ntpd 10.所有节点启动时间同步
timedatectl set-ntp yes版权声明:本文为lovebaby1689原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。