A 自动配置系统时间(手动方式为timedatectl命令,需要关闭ntp相关服务)
使用chronyd或ntpd作为时间同步服务。这两个服务都是NTP的实现,用于同步系统时间。
chronyd:这是一个轻量级的时间同步守护程序,特别适用于嵌入式系统和虚拟机。它通常比ntpd更节省资源。
ntpd:这是NTP的经典实现,已经存在很长时间了。它提供了全面的时间同步功能,但可能比chronyd更消耗资源。
使用如下命令来检查
systemctl status chronyd和ntpd 配置/etc/chrony.conf 和/etc/ntp.conf
# Use public servers from the pool.ntp.org project.
使用来自pool.ntp.org项目的公共服务器
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
.....用server指令指定ntp服务器或者使用pool指令
pool pool.ntp.org iburst
pool指令用于指定一个或多个NTP服务器地址,这与server指令的功能类似,但有一些关键区别。当使用pool时,chrony会尝试连接到池中的所有服务器,并根据其算法选择最佳的服务器来进行时间同步。pool指令特别适用于像pool.ntp.org这样的项目,这些项目维护着一组公共的NTP服务器。
这行配置效果:
它使用pool.ntp.org作为NTP服务器池。这意味着chrony会从该域名的DNS记录中解