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. nginx__的简单搭建和 wsgi

    4 部署 1 配置 uwsig(配置文件) pip3 install uwsgi 1 mkdir uwsgi 2 cd uwsgi 3 touch test_uwsig.ini [uwsgi] # 指 ...

  2. web.py之cookie和session

    官方给的session例子这里就不讲了.下面直接将怎么设置session,取session: session相关代码一定要放在web.py框架的Main.py里面. # Main.py # 设置ses ...

  3. 3.Hbase数据模型

    3.1.Hbase数据模型: 概念视图: 物理视图 Hbase数据在存储系统中是以列族来体现的[Column Family],任何时候可以随意的添加一列到已经存在的列族中 空的单元格在表中不做存储也不 ...

  4. 0006SpringBoot中@Configuration与@Bean联合使用

    需求:将某个普通类做为组件注册到容器中,可通过如下办法 1.定义HelloService类 package springboot_test.springboot_test.service; publi ...

  5. 启动nginx 80端口被占用:tcp 0 0 127.0.0.1:80 127.0.0.1:34932 TIME_WAIT -

    1.启动nginx命令./sbin/nginx 2.提示80端口被占用 nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already ...

  6. Python+request 登录接口reponse的返回值token跨py文件的传递《二》

    主要使用场景: 一般我们在进行接口测试时,依赖登录接口后reponse中的某些返回值,因此需要将login接口单独写一个py文件,另外的py文件均可调用login的reponse返回值使用.共用登录接 ...

  7. 为什么添加了@Aspect 还要加@Component(转)

    官方文档中有写: You may register aspect classes as regular beans in your Spring XML configuration, or autod ...

  8. 11、组件注册-使用FactoryBean注册组件

    11.组件注册-使用FactoryBean注册组件 package org.springframework.beans.factory; import org.springframework.lang ...

  9. 第一次的django 和html的插肩而过

    新建一个Python Django工程: Win+R进入cmd命令界面,并cd到指定工程目录下,比如我的工程目录是E:\wamp\Apache24\www\ 输入E: 跳转E盘 输入cd wamp\A ...

  10. Python--编码的疑惑

    XML语法分析器在处理的时候,使用的是Unicode字符串,并且将其返回.Unicode可以处理特殊字符,但是如果将Unicode字符串转换为普通字符串,就会引发异常,比如Print, >> ...