背景

最近要做阿里云迁移 IDC 机房,整理下 Linux 运维基线,简单记录,以备后用~

安装

# 默认已经安装
$ yum install -y chrony

配置文件

$ cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 国家服务器
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
# 阿里
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


验证服务

# 查看现有的时间服务器
$ chronyc sources -v# 查看时间服务器状态
$ chronyc sourcestats -v# 显示时钟同步相关参数
$ chronyc tracking# 查看当前时区及时间
$ timedatectl



手动同步时间

# 使用 ntpdate 同步时间
$ ntpdate ntp.aliyun.com# chronyd 未启动时,如下命令同步时间
$ chronyd -q 'server pool.ntp.org iburst'# chronyd 启动时,使用如下命令同步时间
$ chronyc -a 'burst 4/4' && sleep 10 && chronyc -a makestep


手动设置时间

# 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'# 设置时间
$ timedatectl set-time '19:00:00'# 设置完成后,再开启
$ timedatectl set-ntp true

参考

  • https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite
  • https://chrony.tuxfamily.org/comparison.html

Centos7 使用 chronyd 进行时钟同步相关推荐

  1. linux centos7 设置主机间时钟同步

    linux centos7 设置主机间时钟同步 安装ntp服务 yum -y install ntp 开启ntp服务 systemctl start ntpd 设置ntp服务开机自启 systemct ...

  2. CentOS7中多台服务器配置时钟同步

    场景 CentOS7中怎样设置静态IP: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/119242495 在上面给三台CentO ...

  3. Centos7 NTP时钟同步配置

    Centos7 NTP时钟同步配置 NTP在Linux下有两种时钟同步方式:直接同步(也称跳跃同步)和平滑同步(也称微调同步). 直接同步 使用ntpdate命令进行同步,直接进行时间变更. 如果服务 ...

  4. CENTOS7网络时钟同步

    CENTOS7网络时钟同步 查询网络上各种资料总结如下: 1,设置时区为上海时区 timedatectl set-timezone Asia/Shanghai 2,安装ntpdate工具 yum -y ...

  5. Linux之搭建chrony时钟同步服务

    一.chrony时钟同步服务   chrony是网络时间协议(NTP)的通用实现.它可以将系统时钟与NTP服务器,参考时钟(例如GPS接收器)以及使用手表和键盘进行的手动输入进行同步.它还可以充当NT ...

  6. ptp(precision time protocol)时钟同步

    一.介绍 1:什么是ptp PTP(Precision Time Protocol) 是一个通过网络同步时钟的一个协议.当硬件支持时,PTP 精度能达到亚微秒,比 NTP(Network Time P ...

  7. ntpd时钟同步服务

    原网址:http://blog.csdn.net/wzyzzu/article/details/46515129 ntpd时钟同步服务 目录 参考: CentOS配置时间同步NTP: http://w ...

  8. 时钟同步服务Chrony

    我们以前的Linux环境大部分用的是ntpd来同步集群中各个服务器的时钟一致性.在新的版本中,我们使用Chrony来替换ntpd来实现时钟同步,这篇文章我们就一起来了解下Chrony. 一 什么是Ch ...

  9. cmd 顺序启动服务_NTP时钟服务器部署以及时钟同步设置

    NTP时钟服务器部署以及时钟同步设置 NTP时钟服务器部署以及时钟同步设置 一.前言 1.NTP简介 NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的 ...

最新文章

  1. SimCSE:用于句子嵌入的对比学习
  2. 设计模式学习 之 单例模式
  3. 网络基础相关知识内容
  4. The Maximum Unreachable Node Set
  5. java e7 e9格式怎么转_java�?e7?a8??e9?a8�ӿ�
  6. Laravel 某个字段更新失败的原因
  7. VC++调用UpdateLayeredWindow实现半透明窗体【转】
  8. android多线程文章,Android 多线程处理之多线程用法大集合
  9. mysql in 命令
  10. 入门机器学习(六)--课后作业解析-logistics回归(python实现)
  11. IPerf——网络测试工具介绍与源码解析(3)
  12. IntelliJ IDEA 14 license key gen
  13. consul命令行查看服务_Go语言微服务架构实战:第十三节 微服务管理--Docker安装及运行consul节点...
  14. 四元数运动学笔记(1)旋转的表示
  15. 用74l138实现一个一位全减器_用react实现一个仿ionic button组件
  16. 黑马程序员Java零基础视频教程(2022最新Java)B站视频学习笔记-Day8-面向对象
  17. 什么是JSONP及其实现原理
  18. html5 live,html5 audio livestreaming
  19. 如何设置WiFi密码才不会被WiFi万能钥匙破解
  20. python 中搞错工作路径的意思导致的相对路径产生bug:[Errno 2] No such file or directory:

热门文章

  1. CCF农产品价格预测-复赛rank2代码公布
  2. slf4j mysql_能显示sql语句,没有报错,但是MySQL里没有表?还有,slf4j是必须的吗?...
  3. 卡开启中断_上网卡顿、网络连接中断……9012年了PC上网还只靠宽带?
  4. Felix: Flexible Text Editing Through Tagging and Insertion (2020-03)
  5. bootstrap css选择不同的宽度
  6. Ubuntu Gitosis安装设置
  7. cocos2d-x学习之添加显示文字
  8. python实现天气预报_python实现智能语音天气预报
  9. navicat远程连接mysql,2003 can't connect to mysql server on 10038
  10. 上海的雨什么时候才可以停...