“ntpd dead but pid file exists”问题解决

NTP服务在重启服务器后,ntpd服务running状态大概10分钟后出现“ntpd dead but pid file exists”问题解决

随后,在/var/log/message中捕捉到以下日志

May 30 09:49:25 localhost ntpd[1921]: 0.0.0.0 c628 08 no_sys_peer
May 30 09:57:14 localhost ntpd[1921]: 0.0.0.0 c617 07 panic_stop +6628 s; set clock manually within 1000 s.

可以看到,ntpd服务有一个限制,ntpd仅同步更改与ntp server时差在1000s内的时间,而上边日志可以看出我们与ntp server时间差已经超过6000+s了,要求你更改时间与ntp server相差时间在1000s以内,然后再去同步服务

 

下边是更改后时间同步设置,从安装到配置过程

1. 安装ntp服务

yum install -y ntp

 

2. 修改配置文件指向自己的NTP服务器

vim /etc/ntp.conf

...

#注释所有其它server

#添加自己的ntp服务

server 10.128.14.25 prefer

...

 

3. 向配置文件追加以下内容

# tinker panic 0   这可以保证ntpd在时间差较大时依然工作

# SYNC_HWCLOCK=yes  允许BIOS与系统时间同步

echo -e "######add for `date +%Y%m%d`#####\ntinker panic 0\nSYNC_HWCLOCK=yes" >>/etc/ntp.conf

 

4. 重启并查看时间是否已同步

/etc/init.d/ntpd restart

date

 

5.  将系统时间同步到硬件

hwclock -w

 

6. 最后将ntpd添加到系统启动

chkconfig ntpd on

 

至此,ntp服务即可正常的同步时间~

 

posted @ 2016-05-30 15:43  Cool_King  阅读(6032)  评论(0编辑  收藏  举报