时间服务器配置
- 查看ntp是否安装
rpm -qa|grep ntp
- 修改ntp配置文件
vim /etc/ntp.conf
- 修改授权网段,使得该网段的所有机器可以查询和同步本主机的时间
# 打开注释,并改为自己网段ip
restrict 192.168.44.0 mask 255.255.255.0 nomodify notrap
- 集群在局域网中,不使用其他互联网上的时间,注释掉同步网络时间
#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 127.127.1.0
fudge 127.127.1.0 stratum 10
- 修改ntpd文件
vim /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
- 重启ntpd服务
service ntpd restart
其他服务器配置
- 停止该服务器的ntpd服务
service ntpd stop
- 修改本机时间,作为测试
date -s '2019-11-11 10:30:20'
- 同步时间
ntpdate 时间服务器ip地址
网友评论