赞
踩
如果服务器在公网环境(能连接外网),可以不采用集群时间同步,下面配置chrony时间同步服务,
安装chrony(在master主机)
yum install -y chrony #安装
systemctl start chrony #启动chrony
修改chrony.conf文件
vim /etc/chrony.conf
## 配置master的 /etc/chrony.conf文件 server times.aliyun.com #修改这里 server cn.pool.ntp.org #修改这里 #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 # Allow NTP client access from local network. allow 192.168.187.0/24 #修改这里 # Serve time even if not synchronized to a time source. local stratum 10 #修改这里
保存退出后重启chrony
systemctl restart chrony
yum install chrony -y
systemctl start chrony #启动chrony
vim /etc/chrony.conf #配置文件
server 192.168.187.129 iburst #修改为master节点的IP地址,以进行时钟同步
#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 192.168.187.129 iburst #修改为master节点的IP地址,以进行时钟同步
#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
分别重启node1和node2的chrony
systemctl restart chrony
date #查看时间是否同步
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。