“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服務即可正常的同步時間~

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM