chrony is a general realization of the Network Time Protocol (NTP) is.
chrony consists of two programs: chronyd is a bootable startup daemon. chronyc program is a command line interface, and monitor the performance of chronyd change various operating parameters during operation.
Compared with other time synchronization software: https://chrony.tuxfamily.org/comparison.html
First, the Installation and Configuration
yum -y install chrony systemctl enable chronyd systemctl start chronyd vim /etc/chrony.conf
chrony.conf default configuration
# Pool.ntp.org project using public servers. Open to the server, in theory, you think how much time server can be added. The public Servers from the Use # pool.ntp.org Project. # Please The joining the Consider the pool (http://www.pool.ntp.org/join.html). Server 0.centos.pool.ntp.org iBurst Server. 1 iBurst .centos.pool.ntp.org server 2.centos.pool.ntp.org iBurst server 3.centos.pool.ntp.org iBurst # is calculated according to the actual time of the server increases or decreases the time ratio, and then records to a file , after the system restart to make the best time to adjust the compensation system. The AT Rate Which the Record # The System Clock Gains / LOSSES Time. The driftfile / var / lib / the chrony / Drift # If the system clock offset greater than one second, the system clock is allowed to update the first three steps. System Clock to the Allow at The # BE stepped in the Updates at The First Three IF offset the ITS SECOND, IS larger Within last 1. Makestep 1.0 3 # Enable real-time clock (RTC) kernel synchronization. Synchronization of the Enable at The Kernel # Real-Time Clock (the RTC). The RTCSYNC # Enable hardware timestamp by using hwtimestamp instruction # timestamping do the Enable Hardware Support IT ON All in the interfaces that. #Hwtimestamp * # at The Increase of Minimum Number The Sources of the appropriate selectable required to the ADJUST at The clock System. #minsources 2 # Specifies the NTP client address, to allow or deny the connection to the server machine play clock # from the allow local NTP client Access Network. #allow 192.168.0.0/16 # Serve, the synchronized Time Not to the even IF a Time Source. #local a Stratum 10 # specified file contains the NTP authentication key. Keys for the Specify File containing # the NTP authentication. #Keyfile /etc/chrony.keys # specify the directory log files. # Specify directory for log files. logdir / var / log / chrony # selected log files to be recorded. # Select which information is logged. #log measurements statistics tracking
Second, the use
ntp server: https://www.cnblogs.com/jhxxb/p/10579816.html
1. The server configuration
chrony.conf to change two
# 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
Turn sync on
enable chronyd systemctl systemctl restart chronyd # View time synchronization status timedatectl Status # open network time synchronization timedatectl the SET -NTP to true
2. Client Configuration
chrony.conf to change two
# 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
Turn sync on
enable chronyd systemctl systemctl restart chronyd # View time synchronization status timedatectl Status # open network time synchronization timedatectl the SET -NTP to true
Third, the command
chronyc usage
# View ntp_servers chronyc Sources - v # View ntp_servers state chronyc sourcestats - v # View ntp_servers is online chronyc Activity - v # ntp View details chronyc Tracking -v
Change the time zone
# View the date and time, time zone and NTP status timedatectl zone list when # View timedatectl List - Timezones timedatectl List -timezones | grep -E " Asia / S. * " When # modify zone timedatectl the SET -timezone Asia / on Shanghai # change date and time (can only modify one) timedatectl the SET - Time " 2019-09-19 15:50:20 " # open the NTP timedatectl the SET -NTP to true / flase