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 ...
随机推荐
- js获取地理位置
直接上代码: if(navigator.geolocation) { navigator.geolocation.getCurrentPosition( function (position) { v ...
- flask自有转换器:int、float、path。默认string
flask自有转换器:int.float.path.默认string # 路由传递的参数默认当做string处理,这里指定int,尖括号中冒号后面的内容是动态的 # -*- coding: utf-8 ...
- X宝个人支付到账
扫码登录,能看懂的我就不多说了,封了我多少篇文章了!!!!X宝个人到账通知.
- 我是怎么找到电子书的 - IT篇
转自于:http://my.oschina.net/0757/blog/375908#OSC_h2_8 IT-ebooks http://it-ebooks.info/ http://www.it-e ...
- 使用JavaScript实现录入信息生成名片
首先是布局: 一个大的盒子模型套两个小的盒子模型:左边是录入信息生成界面,右边是名片显示界面. 框架: 这里新建一个css文件,用于外部链接使用装饰 /*最外层div,主框架*/ .frame{ wi ...
- Django drf:视图层封装、ViewSetMixin、路由配置、解析器、响应器
一.视图层封装 二.ViewSetMixin 三.路由配置 四.解析器 五.响应器 一.视图层封装 1.基本视图 写一个出版社的增删改查resfull接口 路由: url(r'^publish/$', ...
- 马的遍历(BFS
https://www.luogu.org/problemnew/show/P1443 模板BFS...... #include<iostream> #include<cstdio& ...
- golang中fmt的'占位符'使用
golang 的fmt 包实现了格式化I/O函数,类似于C的 printf 和 scanf. # 定义示例类型和变量 type Human struct { Name string } var peo ...
- HBuilderX 5+APP MUI 入门
这一套东西是用来开发app的,可以用html.js什么的写app然后给你打包就能安装到手机上,也可以轻易跨端(需要使用vue,然而我还没有熟练). HBuilder:一个敲代码的软件,敲前端代码超级方 ...
- input 更改 pleaseholder 的字体样式
/* WebKit browsers */input::-webkit-input-placeholder { color: red; font-size: 14px;}/* Mozill ...