Chrony is an implementation program of the ntp protocol, which can be used as a server or a client; it is designed for systems with intermittent Internet connections, and of course it can also be used in a persistent Internet connection environment; chrony has three time references : Hardware clock, real-time clock and manual synchronization.
1. Install time synchronization service on each node
yum install chrony -y
2. Edit the configuration file on the main node
vim /etc/chrony.conf
For the time being, only add the time synchronization server (here you can fill in Ali's according to your needs) and the machine or network segment that allows synchronization with this machine
server http://ntp1.aliyun.com iburst
server http://ntp2.aliyun.com iburst
allow 192.168.0.0/24
3. Configure the time server of the master node on other nodes
server node1 iburst
4. Restart the NTP service, set the boot to start automatically and check if the device is successful
# systemctl restart chronyd.service
# systemctl status chronyd.service
# systemctl enable chronyd.service
# systemctl list-unit-files |grep chronyd.service
5. Set time zone and sync time
# timedatectl set-timezone Asia/Shanghai
# chronyc sources
# timedatectl status
Other nodes have the same time as the master node