检查NTP的配置,并进行修复

笔者的测试环境中,出了一个问题,研究了好久,发现是测试软件的controller和drivers由于在不同的机器上的系统时间相差了两分钟导致的。


经过排查drivers的ntp都还好,就是controller的ntp服务没有开起来。

image

服务都找不到,于是按照下面描述的顺序进行了修复。

image


得到当前的时间设置:

# timedatectl


安装NTP包:

# yum install –y ntp


在启动时就激活NTP服务:

# systemctl enable ntpd


启动NTP服务:

# systemctl start ntpd


修改/etc/ntp.conf 文件,添加ntp服务器到文件中,举例:

server ntp.mycompany.com


使用下面的命令进行一次快速时间同步:

# systemctl stop ntpd

# ntpdate time.mycompany.com
13 Aug 05:15:10 ntpdate[20323]: adjust time server 10.245.104.27 offset -0.000064 sec
# systemctl start ntpd    


NTP终于修复了。

image


参考资料

=================

https://www.certdepot.net/rhel7-set-ntp-service/

posted on 2020-08-13 21:29  中道学友  阅读(696)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上