在Linux中将主从节点进行时间同步的时候,会出现如下所示的问题:
[admin@admin02 ~]$ sudo ntpdate admin01
10 Jul 10:58:33 ntpdate[2472]: the NTP socket is in use, exiting
首先,使用命令ps -aux | grep ntp
查看ntp服务是否已经正常开启
[admin@admin02 ~]$ ps aux | grep ntpd
ntp 1544 0.0 0.1 26492 1916 ? Ss 10:20 0:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
admin 2481 0.0 0.0 103256 832 pts/1 S+ 11:00 0:00 grep ntpd
如上所示的ntp服务已经开启,此时需要手动的将ntp服务停止(注意的是需要使用root权限进行操作)
[root@admin02 init.d]# ./ntpd stop
Shutting down ntpd: [ OK ]
[root@admin02 init.d]# ps aux | grep ntpd
root 2571 0.0 0.0 103252 832 pts/1 S+ 11:09 0:00 grep ntpd
接下来,便可执行对节点间的时间同步问题
[root@admin02 init.d]# ntpdate 192.168.47.101
10 Jul 11:10:02 ntpdate[2574]: adjust time server 192.168.47.101 offset 0.262839 sec