首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在哪里可以看到ntpd的工作状态(日志或消息)

在哪里可以看到ntpd的工作状态(日志或消息)
EN

Server Fault用户
提问于 2016-05-02 13:40:32
回答 1查看 5.1K关注 0票数 1

在我的服务器中,ntpd服务已经启动,但它似乎无法工作。

根据这个( 日志文件位于何处,如何配置ntpd日志文件路径? )和这个( 我在哪里能查到ntpd日志? ) :-(

根据MadHatter的建议(请参阅如何连续地与NTP服务器同步系统时间? ),我在服务器中列出了一些信息:

ntpdate返回:

代码语言:javascript
复制
2 May 21:47:55 ntpdate[47274]: the NTP socket is in use, exiting

ntpq -c as返回:

代码语言:javascript
复制
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返回:

代码语言:javascript
复制
     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 (#行没有列出)是:

代码语言:javascript
复制
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

更新

ntpq -c rv返回:

代码语言:javascript
复制
assID=0 status=0644 leap_none, sync_ntp, 4 events, event_peer/strat_chg,
version="ntpd 4.2.4p8@1.1612-o 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

附注:此服务器位于成都中国(GMT+8)

EN

回答 1

Server Fault用户

回答已采纳

发布于 2016-05-02 15:51:17

明确的声明在您的ntpq -c rv输出中,它说

代码语言:javascript
复制
stratum=3

您已同步;ntpd正在工作。当你的守护进程报告一个不是16的阶层时,你知道你是同步的。在本例中,ntpq -c pe告诉您您的系统对等方(您的守护进程当前正在跟踪的时钟)是time5.aliyun.com,也就是ntp1.aliyun.com。它的阶层是2,而你的阶层是更大的,这是正确的行为。

ntpdate返回套接字正在使用的错误,因为套接字正在使用,因为ntpd正在运行;一旦守护进程运行,您就不能使用ntpdate来改变时钟。这就是为什么通常在启动时,在守护进程启动之前运行ntpdate

票数 5
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/774316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档