chrony简单介绍

简介: 简单介绍

1、简单介绍


2、服务安装


2.1、安装服务


apt install chrony


2.2、参数配置


sed -i  's@server@#server@g' /etc/chrony.conf

echo -e  "server ntpupdate.tencentyun.com iburst" >> /etc/chrony.conf


# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

# servers

server ntpupdate.tencentyun.com iburst


# Record the rate at which the system clock gains/losses time.

driftfile /var/lib/chrony/drift


# Allow the system clock to be stepped in the first three updates

# if its offset is larger than 1 second.

makestep 1.0 3


# Enable kernel synchronization of the real-time clock (RTC).

rtcsync


# 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


# 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


# 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


3、开始同步


3.1、设置时区


timedatectl set-timezone Asia/Shanghai


3.2、开启ntp同步


timedatectl set-ntp yes


3.3、开始同步


systemctl restart chrony


chronyc sources


root@l:/data/liu/git/zgj_toutiao# systemctl restart chrony

root@l:/data/liu/git/zgj_toutiao# chronyc sources

210 Number of sources = 5

MS Name/IP address         Stratum Poll Reach LastRx Last sample              

===============================================================================

^? 169.254.0.79                  2   6     1     2    -26us<span class="token punctuation">[  -26us<span class="token punctuation">] +/-   22ms

^? 169.254.0.80                  2   6     1     1  +1309ns<span class="token punctuation">[+1309ns<span class="token punctuation">] +/-   26ms

^? 169.254.0.81                  2   6     1     1   -103us<span class="token punctuation">[ -103us<span class="token punctuation">] +/-   28ms

^? 169.254.0.82                  2   6     1     1    +62us<span class="token punctuation">[  +62us<span class="token punctuation">] +/-   39ms

^? 169.254.0.83                  2   6     1     1   -356us<span class="token punctuation">[ -356us<span class="token punctuation">] +/-   37ms

相关文章
|
1月前
|
Linux
CentOS 7.x时间同步服务chrony配置详解
文章详细介绍了在CentOS 7.x系统中如何安装和配置chrony服务,以及它与ntpd服务的对比,强调了chrony在时间同步方面的高效性和准确性。
59 1
CentOS 7.x时间同步服务chrony配置详解
|
JavaScript 开发工具 前端开发
|
开发工具
|
开发工具
|
网络协议 网络安全 开发工具
|
监控 关系型数据库 MySQL