首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SES时间同步误差

SES时间同步误差
EN

Server Fault用户
提问于 2014-09-02 07:33:38
回答 2查看 517关注 0票数 1

我的SES设置在过去6个月运行良好,没有任何问题。突然,它昨天停止工作,我得到了臭名昭著的时间同步错误。

自然,我以为ntpd已经停止了,但是当我检查过程树时,我发现它正在运行,这让我感到惊讶。

代码语言:javascript
复制
 ~  ps auwx | grep ntpd                                 
ntp      18223  0.0  0.0  33600  2132 ?        Ss   07:05   0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 106:112
ubuntu   19127  0.0  0.0   8144   668 pts/5    S+   07:19   0:00 grep ntpd

然后我试了ntpdate,上面说

代码语言:javascript
复制
2 Sep 07:16:09 ntpdate[18966]: no servers can be used, exiting

我检查了/etc/ntp.conf文件,默认情况下它列出了默认的ubuntu服务器。

代码语言:javascript
复制
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

我在这里找不到问题。然后我试着检查NTP服务器的状态,没有发现任何问题。

代码语言:javascript
复制
/etc/init.d/ntp status                             
 * NTP server is running

我还尝试手动添加NTP服务器,以查看它是否有效,但这也没有帮助。

代码语言:javascript
复制
 sudo ntpdate ntp.ubuntu.com                         
 2 Sep 07:20:08 ntpdate[19203]: the NTP socket is in use, exiting

我真的不明白这里有什么问题。为什么ntpd在后台运行时不能工作?

任何帮助都将不胜感激。谢谢。

EN

回答 2

Server Fault用户

发布于 2014-09-02 09:41:44

您需要在运行ntpd之前停止ntpdate

代码语言:javascript
复制
sudo service ntp stop
sudo ntpdate 0.ubuntu.pool.ntp.org
sudo service ntp start
票数 0
EN

Server Fault用户

发布于 2014-09-02 09:50:02

在ubuntu上你应该使用

代码语言:javascript
复制
ntpd -q

如果您已经安装了ntpdate,而不是ntpd

手册:

代码语言:javascript
复制
-q     Exit the ntpd just after the first time the clock is set.  This behavior mimics that of the ntpdate program, which is to be retired.
       The -g and -x options can be used with this option.  Note: The kernel time discipline is disabled with this option.
票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/625622

复制
相关文章

相似问题

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