linux时间同步工具chrony的配置和时间设置的相关说明

目录

目录

介绍

1.搭建ntp服务器

 2.配置ntp客户端

3.其他设置

 4.客户端无法进行时间同步


介绍

目前比较流行的时间同步工具有ntpd和chrony,ntpd采用123/UDP端口通信,chrony采用323/UDP端口通信。Centos7以上版本默认安装chrony服务来同步时间,而Centos6则默认安装ntpd服务。如果chrony作为时间同步的服务器,如下图,Chrony默认listen端口是323,通过 323 端口与 chrond 交互,可监控 chronyd 的性能并在运行时更改各种操作参数;chronyd 在后台静默运行并通过 123 端口与时间服务器定时同步时间。机器2作为时间服务器,则需要开放123/udp给客户端服务器。

选择 chrony 是有原因的,相比 ntpd , 它有如下的优点:

1、时间同步的速度比 ntpd 更快

2、chrony 很好的处理了同步延迟以及网络延迟

3、即使出现网络降级,chrony 仍然能正常工作

4、本地机器可以作为时间服务器,其他机器从这台服务器上同步时间

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 配置NTP服务器
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
server ntp.aliyun.com iburst
# Record the rate at which the system clock gains/losses time.

# 记录系统时钟获得/丢失时间的速率至drift文件中
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
# 默认情况下,chronyd通过减慢或加快时钟速度来逐渐调整时钟。如果时钟与实际时间偏差太大,则需要很长时间才能纠正错误。这种方法叫做步进时钟(时间跳变)。
# 此处表示如果时间偏差调整值大于1000秒(16分钟),则立即调整系统时钟,Chrony 允许在前 10 次更新中立即调整系统时钟。超过 10 次后,即使时间偏差超过 1000 秒,Chrony 也将采用逐步微调的方式来同步时间。
make
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值