- 安装Chrony
[root@k8s-master opt]# yum install chrony
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.ustc.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package chrony.x86_64 0:3.4-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================
Installing:
chrony x86_64 3.4-1.el7 base 251 k
Transaction Summary
=====================================================================================================================================================================================
Install 1 Package
Total download size: 251 k
Installed size: 491 k
Is this ok [y/d/N]: y
Downloading packages:
chrony-3.4-1.el7.x86_64.rpm | 251 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : chrony-3.4-1.el7.x86_64 1/1
Verifying : chrony-3.4-1.el7.x86_64 1/1
Installed:
chrony.x86_64 0:3.4-1.el7
Complete!
- 修改配置文件
echo "server ntp1.aliyum.com iburst" > /etc/chrony.conf
- Chony服务 3.1 启动服务
[root@k8s-master opt]# systemctl start chronyd
3.2 设置开机启动
[root@k8s-master opt]# systemctl enable chronyd
3.3 查看服务状态
[root@k8s-master opt]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-09-25 15:27:18 CST; 49s ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Main PID: 14965 (chronyd)
CGroup: /system.slice/chronyd.service
└─14965 /usr/sbin/chronyd
Sep 25 15:27:18 k8s-master systemd[1]: Starting NTP client/server...
Sep 25 15:27:18 k8s-master chronyd[14965]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
Sep 25 15:27:18 k8s-master systemd[1]: Started NTP client/server.
Sep 25 15:27:24 k8s-master chronyd[14965]: Selected source 193.182.111.143
Sep 25 15:27:24 k8s-master chronyd[14965]: System clock wrong by 25.432037 seconds, adjustment started
Sep 25 15:27:50 k8s-master chronyd[14965]: System clock was stepped by 25.432037 seconds
Sep 25 15:27:56 k8s-master chronyd[14965]: Selected source 202.38.64.7
3.4 立刻同步时钟
[root@k8s-master opt]# chronyc tracking
Reference ID : CA264007 (netfee.ustc.edu.cn)
Stratum : 3
Ref time (UTC) : Mon Sep 25 07:27:55 2023
System time : 0.000002488 seconds fast of NTP time
Last offset : -0.002421353 seconds
RMS offset : 0.002421353 seconds
Frequency : 0.000 ppm slow
Residual freq : +103.312 ppm
Skew : 1000000.000 ppm
Root delay : 0.030769050 seconds
Root dispersion : 24.330072403 seconds
Update interval : 2.6 seconds
Leap status : Normal
标签:25,27,CentOS,chronyd,chrony,阿里,master,k8s,时钟
From: https://blog.51cto.com/u_1264026/7604678