当前位置:网站首页>Chrony 时间同步
Chrony 时间同步
2022-07-29 08:19:00 【程序猿历险记】
1. chrony简介:
实现NTP协议的的自由软件。可使系统时钟与NTP服务器,参考时钟(例如GPS接收器)以及使用手表 和键盘的手动输入进行同步。通过Internet同步的两台机器之间的典型精度在几毫秒之内,在LAN上,精度通常为几十微秒。利用硬 件时间戳或硬件参考时钟,可实现亚微秒的精度。
2. chrony安装使用
2.1. chrony安装
| 主机 | IP |
|---|---|
| node01 | 192.168.80.131 |
| node02 | 192.168.80.132 |
| node03 | 192.168.80.133 |
各个节点安装chrony
yum install chrony -y
systemctl enable chronyd.service
systemctl restart chronyd.service
systemctl status chronyd.service

在防火墙内放行,因NTP使用123/UDP端口协议,所以允许NTP服务即可。(如果已关闭防火墙请无视)
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload
2.2 修改node01配置文件
将配置文件中的同步服务器修改为国内的时间服务器(推荐阿里及腾讯)
vim /etc/chrony.conf
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst

重启
systemctl restart chronyd.service
systemctl status chronyd.service

强制同步下系统时钟:
# chronyc -a makestep
查看时间同步源状态:
# chronyc sourcestats
查看时间同步源:
# chronyc sources -v
2.3 node节点配置chrony
在/etc/chrony.conf 配置文件中注释掉之前的IP,新增node01主机的IP地址就可以(记得重启chrony)

2.4 配置文件详解
# 使用pool.ntp.org项目中的公共服务器。以server开,理论上你想添加多少时间服务器都可以。
# 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
# 根据实际时间计算出服务器增减时间的比率,然后记录到一个文件中,在系统重启后为系统做出最佳时间补偿调整。
driftfile /var/lib/chrony/drift
# chronyd根据需求减慢或加速时间调整,
# 在某些情况下系统时钟可能漂移过快,导致时间调整用时过长。
# 该指令强制chronyd调整时期,大于某个阀值时步进调整系统时钟。
# 只有在因chronyd启动时间超过指定的限制时(可使用负值来禁用限制)没有更多时钟更新时才生效。
makestep 1.0 3
# 将启用一个内核模式,在该模式中,系统时间每11分钟会拷贝到实时时钟(RTC)。
rtcsync
# Enable hardware timestamping on all interfaces that support it.
# 通过使用hwtimestamp指令启用硬件时间戳
#hwtimestamp eth0
#hwtimestamp eth1
#hwtimestamp *
# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2
# 指定一台主机、子网,或者网络以允许或拒绝NTP连接到扮演时钟服务器的机器
#allow 192.168.0.0/16
#deny 192.168/16
# Serve time even if not synchronized to a time source.
local stratum 10
# 指定包含NTP验证密钥的文件。
#keyfile /etc/chrony.keys
# 指定日志文件的目录。
logdir /var/log/chrony
# Select which information is logged.
#log measurements statistics tracking
-----------------------------------
著作权归作者所有:来自51CTO博客作者南宫乘风的原创作品,请联系作者获取转载授权,否则将追究法律责任
Centos7集群时间同步(Chrony)
https://blog.51cto.com/heian99/3220521
边栏推荐
- Some simple uses of crawler requests Library
- [beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?
- 【学术相关】为什么很多国内学者的AI的论文复现不了?
- Beautiful girls
- Segment paging and segment page combination
- 网络安全之安全基线
- Inclination monitoring solution of Internet of things
- [beauty of software engineering - column notes] 21 | architecture design: can ordinary programmers also implement complex systems?
- sql判断语句的编写
- Unity - default rendering pipeline - sculpt shader
猜你喜欢

Multifunctional signal generator based on AD9850
![[beauty of software engineering - column notes] 22 | how to do a good job in technology selection for the project?](/img/1a/72bfb3fef59c54188a823ead3a5390.png)
[beauty of software engineering - column notes] 22 | how to do a good job in technology selection for the project?

Tb6600+stm32f407 test

What is the working principle of the noise sensor?

STM32 detection signal frequency

Simulation of four way responder based on 51 single chip microcomputer

Gan: generate adversarial networks

Intelligent shelf safety monitoring system

TCP——滑动窗口

集群使用规范
随机推荐
Back up Google or other browser plug-ins
[beauty of software engineering - column notes] 29 | automated testing: how to kill bugs in the cradle?
ROS common instructions
Tle5012b+stm32f103c8t6 (bluepill) reading angle data
Lora opens a new era of Internet of things -asr6500s, asr6501/6502, asr6505, asr6601
Reading papers on false news detection (4): a novel self-learning semi supervised deep learning network to detect fake news on
Qt/pyqt window type and window flag
Internet worm
Pnpm install appears: err_ PNPM_ PEER_ DEP_ ISSUES Unmet peer dependencies
The difference between torch.tensor and torch.tensor
Dp1332e multi protocol highly integrated contactless read-write chip
Dp1332e multi protocol highly integrated contactless read-write chip
Node: file write data (readfile, WriteFile), two modes: overwrite and increment
Low cost 2.4GHz wireless transceiver chip -- ci24r1
Four pin OLED display based on stm32
Simplefoc parameter adjustment 1-torque control
Collation of ml.net related resources
Alibaba political commissar system - Chapter III, Alibaba political commissar and cultural docking
Importerror: no module named XX
STM32 serial port garbled