1、chronyc命令
chronyc–设置时间与时钟服务器同步
chronyc sources -v //查看 ntp_servers
chronyc sourcestats //查看时间同步源状态
chronyc activity -v //查看 ntp_servers 是否在线
chronyc tracking -v //查看 ntp 详细信息
chronyc -a makestep //强制同步下系统时钟
chrony.conf 默认配置说明
# 使用 pool.ntp.org 项目中的公共服务器。以server开,理论上想添加多少时间服务器都可以。
# Use public servers from the pool.ntp.org project.
# 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 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
# 根据实际时间计算出服务器增减时间的比率,然后记录到一个文件中,在系统重启后为系统做出最佳时间补偿调整。
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# 如果系统时钟的偏移量大于1秒,则允许系统时钟在前三次更新中步进。
# Allow the system clock to be stepped in the first three updates if its offset is larger than 1 second.
makestep 1.0 3
# 启用实时时钟(RTC)的内核同步。
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# 通过使用 hwtimestamp 指令启用硬件时间戳
# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *
# Increase the minimum number of selectable sources required to adjust the system clock.
#minsources 2
# 指定 NTP 客户端地址,以允许或拒绝连接到扮演时钟服务器的机器
# Allow NTP client access from local network.
#allow 192.168.0.0/16
# Serve time even if not synchronized to a time source.

本文介绍如何使用chrony命令配置时间同步服务,并通过timedatectl命令控制系统时间和日期。包括chrony的基本配置、多主机时间同步步骤、常见时区介绍等。
最低0.47元/天 解锁文章
1692

被折叠的 条评论
为什么被折叠?



