Linux 时间同步 Chrony
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://www.linuxprobe.com/centos7-chrony-time.html
https://www.zfl9.com/chrony.html
Linux 时间同步 Chrony的更多相关文章
- Linux 时间同步 05 chrony时间同步
Linux 时间同步 05 chrony时间同步 目录 Linux 时间同步 05 chrony时间同步 chrony 的优势: chrony包介绍 安装chrony 配置与外部时间服务器进行时间同步 ...
- Linux 时间同步 01 简介
Linux 时间同步 01 简介 目录 Linux 时间同步 01 简介 时间同步 公共NTP服务器地址及IP 系统时间相关文件 时间同步 大数据产生与处理系统是各种计算设备集群的,计算设备将统一.同 ...
- Linux时间同步方式记录
Linux时间同步 部署Hadoop集群,遇到各个linux服务器的时间不同步的问题,于是研究了一下linux的时间同步方式,特将同步方式,总结如下: A. 前提条件 a) 网络是连通 ...
- linux时间同步,ntpd、ntpdate
linux时间同步,ntpd.ntpdate 在Windwos中,系统时间的设置很简单,界面操作,通俗易懂.而且设置后,重启,关机都没关系.系统时间会自动保存在Bios的时钟里面,启动计算机的时候,系 ...
- linux 时间同步的2种方法(转)
linux 时间同步的2种方法 张映 发表于 2012-10-23 分类目录: 服务器相关 标签:linux, ntp, 同步, 时间服务器 由于硬件的原因,机器或多或少的根标准时间对不上,一个月的误 ...
- 时间同步chrony
时间同步chrony [root@compute02 ~]# yum install chrony 编辑配置文件 将sever区块下的内容修改为时间服务器的地址 .此处可以写局域网内的 ...
- Linux 时间同步 03 ntpdate时间同步
Linux 时间同步 03 ntpdate时间同步 目录 Linux 时间同步 03 ntpdate时间同步 安装ntpdate 修改/etc/sysconfig/ntpdate 使用ntpdate手 ...
- Linux 时间同步 04 ntp时间同步
Linux 时间同步 04 ntp时间同步 目录 Linux 时间同步 04 ntp时间同步 安装ntp 配置与外部时间服务器进行时间同步的客户端主机 配置其他客户端与以上客户端主机时间同步 验证查看 ...
- Linux 时间同步 02 ntpd、ntpdate的区别
Linux 时间同步 02 ntpd.ntpdate的区别 目录 Linux 时间同步 02 ntpd.ntpdate的区别 [一]这样做不安全. [二]这样做不精确. [三]这样做不够优雅. ntp ...
随机推荐
- vue跳转本页面报错
一个按钮绑定一个方法,方法是跳转到某个路由地址,当已经点击触发方法到该路由下的时候,再进行点击该按钮控制台就会报错,不会影响项目运行 解决方法: if(this.$route.path == '/bi ...
- eclipse调试之edit source lookup path解决方案
转自:https://blog.csdn.net/zkn_CS_DN_2013/article/details/48731133
- stm32 i2c eeprom 24C02
电路图 相关文章:http://blog.csdn.net/zhangxuechao_/article/details/74936798 举例 #define i2c_scl PBout(10) #d ...
- Ubuntu的apt-get代理设置
三种方法 -o选项 # sudo apt-get -o Acquire::http::proxy="http://127.0.0.1:8080/" update 配置文件 # vi ...
- laravel 框架 数据库迁徙时SQLSTATE[420000]错误
问题: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key wa s too long; max key le ...
- MyBatis核心配置文件详析mybatis-cfg.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration PUBLIC & ...
- WIN10安装.net报0x800F081F解决方法
WIN10安装.net2.0和.net3.0报错,错误代码:0x800F081F,解决方法: 方法一:检查服务windows update有无开启,若未开启,开启服务后,再装.net 注:若安装.ne ...
- .netFramework中新增的功能—.net最新信息—.net的发展
关键字:.NET Framework 中的新增功能 链接地址:https://docs.microsoft.com/zh-cn/dotnet/framework/whats-new/index 链接地 ...
- tp5 左连接
db('detainform')->alias('d')->join("information i",'i.z_id=d.z_id','LEFT')->where ...
- Selenium(八)测试用例的设计与模块化
一.设计测试用例 1.分析我之前写的登录脚本: from selenium import webdriver import time from selenium.webdriver.common.ac ...