chrony 是网络时间协议(NTP)的通用实现。

chrony 包含两个程序:chronyd 是一个可以在启动时启动的守护程序。chronyc 是一个命令行界面程序,用于监视 chronyd 的性能并在运行时更改各种操作参数。

与其它时间同步软件的对比:https://chrony.tuxfamily.org/comparison.html

一、安装与配置

yum -y install chrony

systemctl enable chronyd
systemctl start chronyd vim /etc/chrony.conf

chrony.conf 默认配置

# 使用 pool.ntp.org 项目中的公共服务器。以server开,理论上想添加多少时间服务器都可以。
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst # 根据实际时间计算出服务器增减时间的比率,然后记录到一个文件中,在系统重启后为系统做出最佳时间补偿调整。
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift # 如果系统时钟的偏移量大于1秒,则允许系统时钟在前三次更新中步进。
# Allow the system clock to be stepped in the first three updates if its offset is larger than 1 second.
makestep 1.0 3 # 启用实时时钟(RTC)的内核同步。
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync # 通过使用 hwtimestamp 指令启用硬件时间戳
# 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 # 指定 NTP 客户端地址,以允许或拒绝连接到扮演时钟服务器的机器
# 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 # 指定包含 NTP 身份验证密钥的文件。
# 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

二、使用

ntp 服务器:https://www.cnblogs.com/jhxxb/p/10579816.html

1.服务端配置

chrony.conf 修改两处

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server s1a.time.edu.cn iburst
server ntp.aliyun.com iburst # Allow NTP client access from local network.
allow 192.168.8.0/24

开启同步

systemctl enable chronyd
systemctl restart chronyd # 查看时间同步状态
timedatectl status
# 开启网络时间同步
timedatectl set-ntp true

2.客户端配置

chrony.conf 修改两处

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.8.5 iburst # Allow NTP client access from local network.
allow 192.168.8.5

开启同步

systemctl enable chronyd
systemctl restart chronyd # 查看时间同步状态
timedatectl status
# 开启网络时间同步
timedatectl set-ntp true

三、命令

chronyc 用法

# 查看 ntp_servers
chronyc sources -v # 查看 ntp_servers 状态
chronyc sourcestats -v # 查看 ntp_servers 是否在线
chronyc activity -v # 查看 ntp 详细信息
chronyc tracking -v

修改时区

# 查看日期时间、时区及 NTP 状态
timedatectl # 查看时区列表
timedatectl list-timezones
timedatectl list-timezones | grep -E "Asia/S.*" # 修改时区
timedatectl set-timezone Asia/Shanghai # 修改日期时间(可以只修改其中一个)
timedatectl set-time "2019-09-19 15:50:20" # 开启 NTP
timedatectl set-ntp true/flase

https://chrony.tuxfamily.org/

https://www.linuxprobe.com/centos7-chrony-time.html

https://www.zfl9.com/chrony.html

Linux 时间同步 Chrony的更多相关文章

  1. Linux 时间同步 05 chrony时间同步

    Linux 时间同步 05 chrony时间同步 目录 Linux 时间同步 05 chrony时间同步 chrony 的优势: chrony包介绍 安装chrony 配置与外部时间服务器进行时间同步 ...

  2. Linux 时间同步 01 简介

    Linux 时间同步 01 简介 目录 Linux 时间同步 01 简介 时间同步 公共NTP服务器地址及IP 系统时间相关文件 时间同步 大数据产生与处理系统是各种计算设备集群的,计算设备将统一.同 ...

  3. Linux时间同步方式记录

    Linux时间同步 部署Hadoop集群,遇到各个linux服务器的时间不同步的问题,于是研究了一下linux的时间同步方式,特将同步方式,总结如下: A. 前提条件 a)         网络是连通 ...

  4. linux时间同步,ntpd、ntpdate

    linux时间同步,ntpd.ntpdate 在Windwos中,系统时间的设置很简单,界面操作,通俗易懂.而且设置后,重启,关机都没关系.系统时间会自动保存在Bios的时钟里面,启动计算机的时候,系 ...

  5. linux 时间同步的2种方法(转)

    linux 时间同步的2种方法 张映 发表于 2012-10-23 分类目录: 服务器相关 标签:linux, ntp, 同步, 时间服务器 由于硬件的原因,机器或多或少的根标准时间对不上,一个月的误 ...

  6. 时间同步chrony

          时间同步chrony [root@compute02 ~]# yum install chrony   编辑配置文件 将sever区块下的内容修改为时间服务器的地址 .此处可以写局域网内的 ...

  7. Linux 时间同步 03 ntpdate时间同步

    Linux 时间同步 03 ntpdate时间同步 目录 Linux 时间同步 03 ntpdate时间同步 安装ntpdate 修改/etc/sysconfig/ntpdate 使用ntpdate手 ...

  8. Linux 时间同步 04 ntp时间同步

    Linux 时间同步 04 ntp时间同步 目录 Linux 时间同步 04 ntp时间同步 安装ntp 配置与外部时间服务器进行时间同步的客户端主机 配置其他客户端与以上客户端主机时间同步 验证查看 ...

  9. Linux 时间同步 02 ntpd、ntpdate的区别

    Linux 时间同步 02 ntpd.ntpdate的区别 目录 Linux 时间同步 02 ntpd.ntpdate的区别 [一]这样做不安全. [二]这样做不精确. [三]这样做不够优雅. ntp ...

随机推荐

  1. [Vuex系列] - 细说state的几种用法

    state 存放的是一个对象,存放了全部的应用层级的状态,主要是存放我们日常使用的组件之间传递的变量. 我们今天重点讲解下state的几种用法,至于如何从头开始创建Vuex项目,请看我写的第一个文章. ...

  2. laravel 的安装与配置

    1.工作环境 php 7.0+ .MySQL5.1+ 这里可以用开发环境包一键安装: 自己用的是wamp(windows)http://www.wampserver.com/en/ linux系统和m ...

  3. 【ASE模型组】Hint::neural 模型与case study

    模型 基于搜索的提示系统 我们的系统用Pycee针对语法错误给出提示.然而,对于语法正确.结果错误的代码,我们需要另外的解决方式.因此,我们维护一些 (错误代码, 相应提示) 的数据,该数据可以由我们 ...

  4. idou老师教你学Istio 26:如何使用Grafana进行可视化监控

    使用Grafana插件进行监控是Istio提供的监控能力之一.Istio提供丰富的监控能力,Grafana插件在Istio对Prometheus支持的基础上,为用户提供基于网页仪表面板的可视化监控效果 ...

  5. sqlserver 拼接字符串分割

    CREATE FUNCTION [dbo].[fnQuerySplit] ( @string VARCHAR(MAX) ,--待分割字符串 )--分割符 ) ) ) AS BEGIN DECLARE ...

  6. webpack中shimming的概念

    在webpack打包过程中会去做一些代码上的兼容,或者打包过程的兼容,比如之前使用过的babel-polyfill这个工具,他解决了es6代码在低版本浏览器的兼容.这就是webpack中的垫片.他解决 ...

  7. Python基础之类

    一.摘要 面向对象编程 是最有效的软件编写方法之一.在面向对象编程中,你编写表示现实世界中的事物和情景的类,并基于这些类来创建对象.编写类时,你定义一大类对象都有的通用行为.基于类创建对象 时,每个对 ...

  8. 按下开机键,Linux做了什么?

    作者:Vamei 来源:见文末 计算机开机是一个神秘的过程.我们只是按了开机键,就看到屏幕上的进度条或者一行行的输出,直到我们到达登录界面.然而,计算机开机又是个异常脆弱的过程,我们满心期望的登录界面 ...

  9. web后端开发语言Java和PHP的比较

    理念上的不同导致了Java和PHP在Web应用开发上显示了不同的结果,尽管Java的数学计算和数据库访问都有优势,架构也相当完美,但是PHP却可以简单轻松地支持高强度Web访问,能够快速开发应用,支持 ...

  10. scrollReveal(页面缓入效果插件)

    scrollReveal(页面缓入效果插件)实现页面滚动时动画加载元素效果 前面我去了解了元素距页面视图距离,想实现页面滚动是动画加载元素(https://www.cnblogs.com/chengh ...