配置NTP服务。标准的做法是配置NTP服务器,但是这里为了方便就用简化的方式配置了。

这个在安装初期,不是必须的,只要保证各机器的时间同步就行,使用如下命令可以查看时间是否同步:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
[root@cdh1 ~]# date;ssh cdh2 date;
2019年 04月 12日 星期五 16:19:58 CST
2019年 04月 12日 星期五 16:19:59 CST

时间差1-2秒钟就没事。

 


1.执行命令,修改配置。

vim /etc/ntp.conf
            我修改的配置如下,注意第一行配置根据自己centos的网关来配置。

restrict 192.168.9.0 mask 255.255.255.0 nomodify notrap 

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

#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
            

2.执行命令

vim /etc/sysconfig/ntpd
            增加一行:

            SYNC_HWCLOCK=yes

 

 3.重启ntp服务

systemctl restart ntpd.service

systemctl status ntpd.service

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄