客户端配置注意事项(无法与master同步时间)
-
ntpd要启动,systemctl start ntpd&systemctl eanble ntpd
-
计划任务的书写:* * * * * /usr/sbin/ntpdate 192.168.100.1(*与*之间有空格,*与/有空格)
设置 ntp 开机自启动失败
重启后用 service ntpd status 命令查看服务是否启动,从给出的信息可知 ntp 已被设置为开机启动,但是开机启动并未成功。
[root@node ~]# service ntpd status
Redirecting to /bin/systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: inactive (dead)
通过命令 chkconfig ntpd on 设置开机自启动,发现会将此命令转发到 systemctl enable ntpd.service 命令,也就是说最好使用后面的命令设置开机自启动。
[root@node ~]# chkconfig ntpd on
Note: Forwarding request to 'systemctl enable ntpd.service'.
原因是系统上安装了一个与 NTP 相冲突的工具:chrony。
使用 systemctl is-enabled chronyd 来查看, chrony 被设置为enabled。
[root@node ~]# systemctl is-enabled chronyd
enabled
将 chronyd 设置为 disable 后,再重启即可实现NTP自启动。