CentOS7部署Chrony
chrony时间同步服务
1.yum安装(所有节点)
[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 Nov 01 02:46:32 2022 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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!