CentOS 7 时间同步配置:chrony 多机器同步设置(北京时间)
- 安装 chrony
在 CentOS7 中,chrony 是默认的时间同步服务,如果没有安装,可以使用以下命令安装:
yum install chrony -y
- 配置 chrony
编辑 /etc/chrony.conf 文件:
vi /etc/chrony.conf
在文件末尾添加以下内容:
server master iburst
server '<ip2>' iburst
server '<ip3>' iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
其中,master 是时间同步的主机,'
- 启动 chrony
启动 chrony 服务并设置开机自启:
systemctl start chronyd
systemctl enable chronyd
- 检查时间同步
使用以下命令检查时间同步:
chronyc tracking
如果输出结果中的 'Last offset' 和 'RMS offset' 很小,则表示时间同步成功。
原文地址: https://www.cveoy.top/t/topic/m9VO 著作权归作者所有。请勿转载和采集!