AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[ntpdate](server)

Martin Hope
George Y
Asked: 2022-04-12 06:12:16 +0800 CST

ntpdate 在 CentOS8 上不可用

  • 2

我想像往常一样在 CentOS8 上安装 ntpdate。但是,它不可用:

# cat /proc/version
Linux version 4.18.0-240.1.1.el8_3.x86_64 ([email protected]) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Nov 19 17:20:08 UTC 2020

# yum install -y ntpdate
Last metadata expiration check: 2:21:14 ago on Mon 11 Apr 2022 07:39:43 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
No match for argument: ntpdate
Error: Unable to find a match: ntpdate

此外,我也发现links lynx不可用。有什么方法可以在 CenOS 8 上安装 ntpdate 吗?

yum ntpdate centos8
  • 1 个回答
  • 2181 Views
Martin Hope
j9dy
Asked: 2016-10-01 01:26:13 +0800 CST

如何在 ubuntu 上设置没有 Internet 访问的本地 ntp 服务器?

  • 7

我已经尝试了几个关于如何在 ubuntu 上设置本地 ntp 服务器的指南,但似乎没有一个可以正常工作。由于某种原因,我的服务器在时间上严重漂移,我必须保持它们的时间紧密相连,因为我运行需要这个的数据库。

  • 我有 8 个 ubuntu 14.04 LTS 服务器,没有一个可以访问互联网
  • 我想在一个(或多个,如果更好的话)服务器上运行一个 ntp 服务器,并让所有其他服务器连接到 ntp 服务器来设置时间

目前,我的服务器(ip .24)运行这个/etc/ntp.conf:

server 127.127.1.0 prefer
fudge  127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

# Give localhost full access rights
restrict 127.0.0.1

# Give machines on our network access to query us
restrict 192.168.178.0 mask 255.255.255.0 nomodify notrap

broadcast 192.168.178.0

在“客户”上:

# Point to our network's master time server
server 192.168.178.24 iburst
fudge 192.168.178.24  stratum 10

restrict default ignore
restrict ::1
restrict 127.0.0.1
restrict 192.168.178.24 mask 255.255.255.255 nomodify notrap noquery

driftfile /var/lib/ntp/drift

minpoll 4
maxpoll 5

注意:我使用 Multi-Tabbed Putty 将以下命令同时发送到所有 ntp 客户端。 我已经停止了除服务器之外的所有 ntp 服务,用于sudo ntpdate 192.168.178.24让他们获取日期并随后重新启动 ntp 服务。这成功了。命令完成后,所有服务器都直接显示相同的日期。然而,大约 10 分钟后,我的服务器显示以下时间:

Fr 30. Sep 11:16:53 CEST 2016
Fr 30. Sep 11:15:33 CEST 2016 (server .24) 
Fr 30. Sep 11:16:50 CEST 2016
Fr 30. Sep 11:15:33 CEST 2016
Fr 30. Sep 11:17:05 CEST 2016
Fr 30. Sep 11:15:33 CEST 2016
Fr 30. Sep 11:15:33 CEST 2016
Fr 30. Sep 11:15:33 CEST 2016

如何让它们正确同步到 ntp 服务器?我怎样才能降低轮询时间?看起来我的服务器快不同步了,所以我需要它们再次检索“正确”的时间......

“正确”时间是指所有服务器都相同的时间。它不一定需要是完全正确的世界时间(如果你这样称呼它)。


编辑:我已经尝试了建议的配置设置。据我了解,这就是我的服务器/客户端配置的样子。与此同时,我发现我的 .24 服务器实际上正在走向更糟糕的时期。.20 服务器是最准确的服务器,我现在使用 .20 服务器来托管 ntp 服务器。对困惑感到抱歉。

服务器配置:

# Use the local clock
server 127.127.1.0 prefer
fudge  127.127.1.0
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

# Give localhost full access rights
restrict default

# Give machines on our network access to query us
restrict 192.168.178.0 mask 255.255.255.0 nomodify notrap

broadcast 192.168.178.0

对于客户:

# Point to our network's master time server
server 192.168.178.20 iburst

restrict default

driftfile /var/lib/ntp/drift

minpoll 4
maxpoll 5

服务器上的 ntpq -as 和 ntpq -pe:

ntpq -c as
ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 41906  963a   yes   yes  none  sys.peer    sys_peer  3
  2 41907  8811   yes  none  none    reject    mobilize  1

ntpq -c pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.           5 l   60   64  377    0.000    0.000   0.000
 192.168.178.0   .BCST.          16 u    -   64    0    0.000    0.000   0.000

类似这样的输出的五倍(这些服务器随时间漂移):

ntpq -c as
ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 62104  9024   yes   yes  none    reject   reachable  2


ntpq -c pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 hadoop20.xx LOCAL(0)         6 u   27   64  377    0.151  63591.8 33407.0

对于两个(最有可能?)工作客户:

ntpq -c as
ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1  7757  963a   yes   yes  none  sys.peer    sys_peer  3

ntpq -c pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*hadoop20.xx LOCAL(0)         6 u   18   64  377    0.183    7.883   3.015

编辑2:

我已在所有客户端上使用sudo service ntp stop, sudo ntpdate 192.168.178.20, 等待 ntpdate 完成。sudo service ntp start仍然只有 2 个成功的客户和 5 个拒绝的客户。

拒绝客户端显示此输出。delay+值看起来很高,因为失败的客户端会随着offset时间漂移。也许他们不相信服务器会更新时间,因为延迟/偏移量太高了?

ntpq -c as
ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 20981  905a   yes   yes  none    reject    sys_peer  5

ntpq -c pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 hadoop20.xx LOCAL(0)         6 u   34   64    3    0.166  18665.9 16201.3

我也尝试过使用这个https://askubuntu.com/a/256004答案,它工作了大约 30 秒,然后状态再次变为“拒绝”!对ntpdate -s 192.168.178.20. 这很可能与 ntp 客户端拒绝服务器的时间有关。有没有办法强迫他们改变时间?

ubuntu ntp time-synchronization ntpd ntpdate
  • 3 个回答
  • 51393 Views
Martin Hope
M. Barbieri
Asked: 2016-06-01 08:16:23 +0800 CST

尝试为 RHEL7.1 启动“ntpdate.service”时出错

  • 0

我正在尝试为 openstack 重新启动服务,并在我的运行下/etc/systemd/system/multi-user.target.wants/运行 asystemctl start ntpdate.service并收到以下错误:

    5 月 31 日 12:05:39 localhost.localdomain systemd[1]:开始通过 NTP 设置时间...
    5 月 31 日 12:06:09 localhost.localdomain systemd[1]: ntpdate.service: main process exited, code=exited, status=1/FAILURE
    5 月 31 日 12:06:09 localhost.localdomain systemd[1]: 无法通过 NTP 启动设置时间。
    5 月 31 日 12:06:09 localhost.localdomain systemd[1]: Unit ntpdate.service 进入失败状态。
    5 月 31 日 12:06:09 localhost.localdomain systemd[1]: ntpdate.service 失败。

我似乎也无法ntp.log在/var/log/目录中找到。我相信这也搞砸了我的rabbitmq-server.service,但当时的一个问题。

有什么建议么?

ntp ntpdate rhel7
  • 1 个回答
  • 12277 Views
Martin Hope
auntyellow
Asked: 2016-05-03 05:40:32 +0800 CST

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

  • 1

在我的服务器中,ntpd 服务已启动,但似乎不起作用。

根据这个(ntpd 日志文件位于哪里,我们如何配置 ntpd 日志文件路径?)和这个(我在哪里可以查找 ntpd 日志?)我什么也找不到:-(

根据 MadHatter 的建议(参见How can I synchronize system time with a NTP server continuous?),我在我的服务器中列出了一些信息:

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

更新

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)

ntp ntpd ntpdate
  • 1 个回答
  • 4694 Views
Martin Hope
auntyellow
Asked: 2016-05-02 22:58:19 +0800 CST

如何持续与 NTP 服务器同步系统时间?

  • 2

是否有 linux 服务可以以给定的时间间隔(例如 1 分钟、1 小时或 1 天)将系统时间与 NTP 服务器同步?

在 cron 选项卡中运行 utpdate 是一个好习惯吗?例如

*/10 * * * * /usr/sbin/ntpdate us.pool.ntp.org

更新

在我的服务器中,ntpd服务已启动,但似乎不起作用。我在哪里可以看到 ntpd 工作状态(日志或消息)?根据这个(ntpd 日志文件位于哪里,我们如何配置 ntpd 日志文件路径?)和这个(我在哪里可以查找 ntpd 日志?)我什么也找不到:-(

ntp ntpd ntpdate
  • 1 个回答
  • 1117 Views
Martin Hope
Andres Jaan Tack
Asked: 2010-01-16 15:06:21 +0800 CST

在 Ubuntu 上禁用时间同步

  • 5

我正在虚拟机中使用 Ubuntu 设置开发环境。由于一些愚蠢的定时炸弹问题, VM 中的日期必须是 2009 年,所以我想禁用任何自动时间同步(例如 ntpdate)。

$ sudo apt-get remove ntpdate
...
The following packages will be REMOVED:
ntpdate ubuntu-minimal

显然,我不想删除 ubuntu-minimal。不幸的是,机器每隔几秒钟就会重新设置时间。如何禁用此功能或删除此功能?

ubuntu time virtual-machines ntpdate
  • 4 个回答
  • 16658 Views
Martin Hope
Unknown
Asked: 2009-06-01 16:39:40 +0800 CST

比较 NTPD 和 ntpdate

  • 23

这两种服务器同步方式的优缺点是什么?

在我看来,您的服务器每天的漂移可能不会超过 1 秒,因此 crontab 上的 ntpdate 就可以了。但我听说你可以在这里使用冗余的 NTP 服务器

http://www.pool.ntp.org/en/use.html

以便在发生故障时保持同步时间。

你有什么建议吗?

time ntp ntpd ntpdate
  • 10 个回答
  • 26996 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve