chrony时间同步服务⏱️

chrony时间同步服务⏱️

1.安装chrony服务(所有节点)

[root@localhost ~]# yum -y install chrony

2.服务端配置

[root@localhost ~]# cat > /etc/chrony.conf << EOF 
server ntp.aliyun.com iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
allow 10.0.0.0/24
local stratum 10
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
EOF

[root@localhost ~]# systemctl restart chronyd && systemctl enable chronyd

客户端配置

[root@localhost ~]# cat > /etc/chrony.conf << EOF 
pool 192.168.0.37 iburst                         #(ip为服务端ip)
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
EOF

[root@localhost ~]# systemctl start chronyd && systemctl enable chronyd

3.chronyc使用

客户端验证

[root@k8s-master02 kubernetes]# chronyc sources -v
210 Number of sources = 1

.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* k8s-master01 3 6 377 30 -187us[ -79us] +/- 17ms                     #(k8s-master01为服务端ip)
查看ntp-server是否在线
[root@k8s-master01 ~]# chronyc activity -v
200 OK
1 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address

查看ntp详细信息

[root@k8s-master01 ~]# chronyc tracking -v
Reference ID    : CB6B0658 (203.107.6.88)
Stratum         : 3
Ref time (UTC)  : Tue Aug 01 02:46:32 2023
System time     : 0.000321720 seconds fast of NTP time
Last offset     : +0.000434528 seconds
RMS offset      : 0.001262305 seconds
Frequency       : 10.066 ppm fast
Residual freq   : +0.138 ppm
Skew            : 4.369 ppm
Root delay      : 0.026981421 seconds
Root dispersion : 0.003280478 seconds
Update interval : 130.3 seconds
Leap status     : Normal

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值