当初搭建RAC环境(虚拟机上搭建)的时候使用了NTP来同步时间,今天启动的时候时间不同步了,在客户端上执行同步时间的命令,出现了
以下错误:
[root@vmac1 ~]# crontab -l
0 * * * * ntpdate 192.168.3.102 >> /root/ntpdate.log 2>&1
[root@vmac1 ~]# ntpdate 192.168.3.102 >> /root/ntpdate.log 2>&1
[root@vmac1 ~]# date
Thu Mar 26 15:37:25 EDT 2015
[root@vmac1 ~]# cat /root/ntpdate.log
…………
/bin/sh: ntpdate: command not found
26 Mar 15:17:04 ntpdate[21342]: the NTP socket is in use, exiting
26 Mar 15:31:17 ntpdate[22056]: the NTP socket is in use, exiting
26 Mar
解决方法
您收到此错误消息的原因是由于 xntpd 已经绑定到了该 Socket。运行 ntpdate 时,它会首先进行广播,然后侦听端口 123。如果 xntpd 正在运行,而有一个进程已经在侦听该端口了,则会使 ntpdate 无法在上面运行。运行下列命令,即可找出 xntpd 的 PID
ps -ef|grep xntpd
可惜没有找到pid。
使用lsof –i:123
[root@vmac1 ~]# lsof -i:123
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ntpd 22333 ntp 16u IPv4 258219 0t0 UDP *:ntp
ntpd 22333 ntp 17u IPv6 258220 0t0 UDP *:ntp
ntpd 22333 ntp 18u IPv6 258221 0t0 UDP localhost6.localdomain6:ntp
ntpd 22333 ntp 19u IPv6 258222 0t0 UDP [fe80::a00:27ff:fe81:e568]:ntp
ntpd 22333 ntp 20u IPv6 258223 0t0 UDP [fe80::a00:27ff:fec4:3897]:ntp
ntpd 22333 ntp 21u IPv6 258224 0t0 UDP [fe80::a00:27ff:fe2b:9a3c]:ntp
ntpd 22333 ntp 22u IPv4 258225 0t0 UDP rac1.localdomain:ntp
ntpd 22333 ntp 23u IPv4 258226 0t0 UDP 192.168.3.101:ntp
ntpd 22333 ntp 24u IPv4 258227 0t0 UDP vmac1:ntp
ntpd 22333 ntp 25u IPv4 258228 0t0 UDP vmac1-vip:ntp
ntpd 22333 ntp 26u IPv4 258229 0t0 UDP vmac-cluster:ntp
ntpd 22333 ntp 27u IPv4 258230 0t0 UDP vmac1-priv:ntp
[root@vmac1 ~]# kill -9 22333
[root@vmac1 ~]# lsof -i:123
[root@vmac1 ~]# crontab -l
0 * * * * ntpdate 192.168.3.102 >> /root/ntpdate.log 2>&1