CentOS同步阿里云时钟
  aOYB9Qh7rxCg 2023年11月02日 39 0
  1. 安装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!
  1. 修改配置文件
echo "server ntp1.aliyum.com iburst" > /etc/chrony.conf
  1. 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
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  ZydNzX6XOBO2   2023年11月02日   110   0   0 出队C++ci#include
  QL8BnSL91Ugt   2023年11月02日   50   0   0 IPhtmlciIPhtmlci
aOYB9Qh7rxCg