Centos7 使用 chronyd 进行时钟同步_chronyd -q ‘server pool

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

server ntp.aliyun.com

腾讯

server time1.cloud.tencent.com
server time2.cloud.tencent.com
server time3.cloud.tencent.com
server time4.cloud.tencent.com
server time5.cloud.tencent.com

苹果

server time.asia.apple.com

微软

server time.windows.com

其他

server cn.ntp.org.cn

Record the rate at which the system clock gains/losses time.

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.

makestep 1.0 3

Enable kernel synchronization of the real-time clock (RTC).

rtcsync

Enable hardware timestamping on all interfaces that support it.

#hwtimestamp *

Increase the minimum number of selectable sources required to adjust

the system clock.

#minsources 2

Allow NTP client access from local network.

#allow 192.168.0.0/16

Serve time even if not synchronized to a time source.

#local stratum 10

Specify file containing keys for NTP authentication.

#keyfile /etc/chrony.keys

Specify directory for log files.

logdir /var/log/chrony

Select which information is logged.

#log measurements statistics tracking


启动服务及时区设置



启动服务

$ systemctl start chronyd

开机启动

$ systemctl enable chronyd

查看当前状态

$ systemctl status chronyd

查看亚洲时区

$ timedatectl list-timezones | grep Asia

设置时区

$ timedatectl set-timezone Asia/Shanghai


![在这里插入图片描述](https://img-blog.csdnimg.cn/20210604115450343.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwOTA3OTc3,size_16,color_FFFFFF,t_70)  
 验证服务



查看现有的时间服务器

$ chronyc sources -v

查看时间服务器状态

$ chronyc sourcestats -v

显示时钟同步相关参数

$ chronyc tracking

查看当前时区及时间

$ timedatectl


![在这里插入图片描述](https://img-blog.csdnimg.cn/20210604115522224.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwOTA3OTc3,size_16,color_FFFFFF,t_70)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210604115543743.png)  
 手动同步时间



使用 ntpdate 同步时间

$ ntpdate ntp.aliyun.com

chronyd 未启动时,如下命令同步时间

$ chronyd -q ‘server pool.ntp.org iburst’

chronyd 启动时,使用如下命令同步时间

$ chronyc -a ‘burst 4/4’ && sleep 10 && chronyc -a makestep


![在这里插入图片描述](https://img-blog.csdnimg.cn/20210604115705581.png)  
 手动设置时间



date 设置时间

$ date -s ‘2021-06-03 19:00:00’

关闭 ntp 同步后,才可以使用 timedatectl 进行时间设置

$ timedatectl set-ntp false

设置日期和时间

$ timedatectl set-time ‘2021-06-03 19:00:00’

设置日期

$ timedatectl set-time ‘2021-06-03’

设置时间

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化的资料的朋友,可以戳这里获取

化!**

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化的资料的朋友,可以戳这里获取

  • 30
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值