Chrony同步时间说明,区别NTP


从用于 RHEL 7.2 及更高发行版和 SLES 12 及更高发行版的 Db2? 11.1.3.3 开始,Chrony 受支持。

本主题概述如何使用 chronyd 设置网络时间协议 (NTP) 服务器以确保运行实例的所有服务器都具有类似的时间设置。

使用以下步骤以通过 chronyd 将集群中的某个主机或成员可访问的另一主机配置为 NTP 服务器。此主机上的系统时钟将用作已同步的时钟。此主机必须保持在线,才能继续使主机上的时钟同步。

NTP 服务器的主机。

编辑 /etc/chrony.conf 并确保它具有以下行:
driftfile /var/lib/chrony/drift
local stratum 8
manual
allow 192.168.165
允许字段中的地址为允许客户机从其进行连接的网络地址或子网地址。

客户机

#编辑 /etc/chrony.conf 并确保它具有以下行:
server master iburst
driftfile /var/lib/chrony/drift
logdir /var/log/chrony
log measurements statistics tracking
#在每个主机上启动并启用 chronyd:
systemctl start chronyd 
systemctl enable chronyd

确保在集群中的所有主机上仅设置了 ntpd 或 chronyd 的其中之一。否则,可能导致意外行为。特别是它们已针对另一时间服务器同步时。

两个服务不能同时运行,只能选择其中一个,大多数情况下,如果涉及其它非服务器设备,我们目前的选择仍然是ntpd更好。

systemctl start ntpd.service
systemctl stop ntpd.service
systemctl restart ntpd.service
systemctl enable ntpd.service
systemctl disable ntpd.service


systemctl start chronyd.service
systemctl stop chronyd.service
systemctl restart chronyd.service
systemctl enable chronyd.service
systemctl disable chronyd.service