Centos7 configures each slave node to synchronize time with the master node

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

Insert picture description here

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

Insert picture description here
Other nodes have the same time as the master node

Guess you like

Origin blog.csdn.net/yj2434/article/details/112424257