chrony軟件使用說明html
1、chrony簡介vim
chrony是一個開源的自由軟件,它能保持系統時鐘與時間服務器(ntp)同步,centos
讓時間保持精確。服務器
它由兩個程序組成:chrongd和chronyc。ide
chronyd是一個後臺運行的守護進程,用於調整內核運行的系統時鐘和時間服務器同步。ui
它肯定計算機增減時間的比率,並對此進行補償。spa
chrony是CentOs7.x上自帶的時間同步軟件orm
2、chrony的操做server
#yum install -y chrony -->安裝服務htm
#systemctl start chronyd.service -->啓動服務
#systemctl enable chronyd.service -->設置開機自自動,默認是enable
3、chrony配置文件
chrony服務使用的配置文件爲/etc/chrony.conf
其配置內容格式和ntpd服務基本類似
[root@chrony ~]# vim /etc/chrony.conf
# 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
server ntp1.aliyun.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.56.0/24
# 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