当前位置:   article > 正文

Linux CentOS 8.5 安装NTP时间服务器 chrony时间同步服务 阿里云NTP时间服务器+腾讯云NTP时间服务器

Linux CentOS 8.5 安装NTP时间服务器 chrony时间同步服务 阿里云NTP时间服务器+腾讯云NTP时间服务器

特殊云服务,可能只有DMZ区域服务器可以访问特定的互联网地址,而应用服务器和数据库服务器不能访问互联网的。同步时间可以开通访问DMZ时间服务器.

本文依这篇为例:详细教程 Centos8.5 基于 k8s v1.30.1 部署高可用集群 kubeadm 安装 kubernetes v1.30.1 docker集群搭建 延长证书有效期-CSDN博客

常见网络架构:

1 CentOS 8 默认使用的时间同步服务是 chronyd ,能够保持系统时间的同步更准确。

  1. #master11如果没有安装,执行
  2. yum install chrony
  3. #vim /etc/chrony.conf
  4. pool 2.centos.pool.ntp.org iburst --> #pool 2.centos.pool.ntp.org iburst
  5. #allow 192.168.0.0/16 --> allow 192.168.50.0/24
  6. server ntp5.aliyun.com iburst
  7. server ntp6.aliyun.com iburst
  8. server ntp7.aliyun.com iburst
  9. server time1.tencentyun.com iburst
  10. server time2.tencentyun.com iburst
  11. server time3.tencentyun.com iburst
  12. #启动配置
  13. systemctl enable chronyd
  14. systemctl start chronyd
  15. #查看
  16. systemctl status chronyd

 #查看同步

  1. root@master11 ~]# chronyc sources
  2. MS Name/IP address Stratum Poll Reach LastRx Last sample
  3. ===============================================================================
  4. ^* 203.107.6.88 2 6 177 7 +4846us[+7827us] +/- 23ms
  5. [root@master11 ~]# timedatectl status
  6. Local time: Sat 2024-05-18 22:12:08 CST
  7. Universal time: Sat 2024-05-18 14:12:08 UTC
  8. RTC time: Sat 2024-05-18 14:12:07
  9. Time zone: Asia/Shanghai (CST, +0800)
  10. System clock synchronized: yes
  11. NTP service: active
  12. RTC in local TZ: no

 2 节点配置

  1. [root@slave12 ~]# vim /etc/chrony.conf
  2. pool 2.centos.pool.ntp.org iburst -->#pool 2.centos.pool.ntp.org iburst
  3. server 192.168.50.11 iburst
  4. #查看同步
  5. [root@slave12 ~]# chronyc sources
  6. MS Name/IP address Stratum Poll Reach LastRx Last sample
  7. ===============================================================================
  8. ^* master11 3 6 37 63 +1257ns[+3073us] +/- 23ms
  9. [root@slave12 ~]# chronyc sourcestats -v
  10. .- Number of sample points in measurement set.
  11. / .- Number of residual runs with same sign.
  12. | / .- Length of measurement set (time).
  13. | | / .- Est. clock freq error (ppm).
  14. | | | / .- Est. error in freq.
  15. | | | | / .- Est. offset.
  16. | | | | | | On the -.
  17. | | | | | | samples. \
  18. | | | | | | |
  19. Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
  20. ==============================================================================
  21. master11 6 3 136 -4.415 52.325 -16ns 568us
  1. [root@slave13 ~]# vim /etc/chrony.conf
  2. pool 2.centos.pool.ntp.org iburst -->#pool 2.centos.pool.ntp.org iburst
  3. server 192.168.50.11 iburst
  4. [root@slave13 ~]# chronyc sources
  5. MS Name/IP address Stratum Poll Reach LastRx Last sample
  6. ===============================================================================
  7. ^* master11 3 6 17 4 -17us[ -21us] +/- 24ms

3  chronyc 可配置

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/609236
推荐阅读
相关标签
  

闽ICP备14008679号