ntp

环境:
RAC1:192.168.58.101
RAC2:192.168.56.102
设定RAC2同步RAC1的时间

1.两台机器上都安装ntp
yum install ntp

2.设置开机启动
两台机器上都要执行,安装完毕之后,启动服务
#systemctl start ntpd.service
设置开机自启动
#systemctl enable ntpd.service

#查看状态
systemctl status ntpd.service

3.ntp服务端设置
RAC1=192.168.58.101,作为ntpserver
# vim /etc/ntp.conf
#添加此行
restrict 192.168.0.0 mask 255.255.255.0


设置后,重启ntpd服务,用ntpstat来检查效果【大概几秒钟就可以看到效果】
#systemctl restart ntpd
#ntpstat


4.ntp客户端设置
RAC2=192.168.58.102 作为ntpclient,将他设置为同步上面的ntpserver,同样需要一个简单配置
修改/etc/ntp.conf文件,注释掉外网时间服务器,添加本地服务器即可
#vi /etc/ntp.conf,添加如下行
server server 192.168.58.101
restrict server 192.168.58.101 nomodify notrap noquery
server 127.0.0.1
fudge 127.0.0.1 stratum 10


设置后,重启ntpd服务,用ntpstat来检查效果【大概需要等十五分钟,看到效果】
#systemctl restart ntpd
#ntpstat

#这里好等几分钟
[root@host02 /]# ntpstat
synchronised to NTP server (192.168.58.101) at stratum 13
   time correct to within 950 ms
   polling server every 64 s

 

解决ntp开机不能自动启动问题:

systemctl disable chronyd

 

posted @ 2020-03-31 15:26  slnngk  阅读(239)  评论(0编辑  收藏  举报