在我的服务器ntpd服务启动,但似乎没有工作。
我根本找不到任何东西( ntpd日志文件在哪里,我们如何configurationntpd日志文件path? )和这个( 我在哪里可以查找ntpd日志? ):-(
根据MadHatter的build议(请参阅如何使系统时间与NTP服务器连续同步? ),我在服务器中列出了一些信息:
ntpdate
返回:
2 May 21:47:55 ntpdate[47274]: the NTP socket is in use, exiting
ntpq -c as
回报:
ind assID status conf reach auth condition last_event cnt =========================================================== 1 22393 9614 yes yes none sys.peer reachable 1 2 22394 9414 yes yes none candidat reachable 1 3 22395 9414 yes yes none candidat reachable 1
ntpq -c pe
返回:
remote refid st t when poll reach delay offset jitter ============================================================================== *time5.aliyun.co 10.137.38.86 2 u 157 1024 377 42.869 3.156 0.274 +time7.aliyun.co 10.137.38.86 2 u 402 1024 377 42.997 4.893 0.251 +ntp3.aliyun.com 10.137.38.86 2 u 276 1024 377 38.393 7.159 0.263
而我的ntp.conf
(#行没有列出)是:
minpoll 4 maxpoll 8 driftfile /var/lib/ntp/drift restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict -6 ::1 server ntp1.aliyun.com server ntp2.aliyun.com server ntp3.aliyun.com includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
UPDATE
ntpq -c rv
返回:
assID=0 status=0644 leap_none, sync_ntp, 4 events, event_peer/strat_chg, version="ntpd [email protected] Tue Nov 29 00:09:12 UTC 2011 (1)", processor="x86_64", system="Linux/2.6.32-220.4.1.el6.x86_64", leap=00, stratum=3, precision=-20, rootdelay=42.918, rootdispersion=11.376, peer=18777, refid=182.92.12.11, reftime=dad1e8b1.6b42ba77 Mon, May 2 2016 22:54:41.418, poll=8, clock=dad1e995.5771e298 Mon, May 2 2016 22:58:29.341, state=4, offset=-0.578, frequency=23.898, jitter=1.845, noise=1.218, stability=0.223, tai=0
ps本服务器位于中国成都(GMT + 8)
这个权威性声明在你的ntpq -c rv
输出中
stratum=3
你是同步的; ntpd
正在工作 。 当你的守护进程报告一个不是16的层时,你知道你是同步的。 在这种情况下, ntpq -c pe
告诉你你的系统节点(守护进程当前所在时钟的节点)是time5.aliyun.com
,又名ntp1.aliyun.com
。 它的阶层是2,而你的阶层是更大的,这是正确的行为。
ntpdate
返回套接字使用中的错误,因为套接字正在使用,因为ntpd
正在运行; 一旦守护进程运行,你不能使用ntpdate
来移动时钟。 这就是为什么ntpdate
通常在启动时在守护进程启动之前运行的原因。