Time synchronization build ntp server, cluster automatically synchronize time and ntpdate command~!

Environmental preparation

Two centos7, firewall closed, selinux closed
server (server): 192.168.112.153
client (client): 192.168.112.154

Step start

1. View the current system kernel

  • Confirm that the server and client versions are the same
cat /etc/redhat-release
  • Execution effect chart
    Insert picture description here

2. Server installation service

yum -y install ntp
  • After installation, check

Insert picture description here

3. Modify the configuration file

vim /etc/ntp.conf 
  • Comment out line 8
    Insert picture description here
  • Comment out lines 13, 14
    Insert picture description here
  • Remove the comment (#) on line 17 and modify the local IP
    Insert picture description here
    resolution: Allow updated IP address segment to synchronize time
  • Comment out lines 21 to 24
    Insert picture description here
  • 25.26 line added

Insert picture description here
Analysis: If the network time synchronization server is not available, provide services to the client based on the local time

4. Start the service

systemctl start ntpd     启动
systemctl enable ntpd    开机自启

5. View service status

systemctl status ntpd

Insert picture description here

ntp check to
Insert picture description here
see if it is synchronized
Insert picture description here

6. Verify time synchronization

Client install ntp service

 yum -y install ntp

synchronised time

ntpdate -u 192.168.112.153

Insert picture description here
Check time

date

Insert picture description here

Anti-thunder

      • If the time on the server side changes or changes manually,
        remember to restart the service! ! !
  • Change the verification rendering
  1. Server modification, restart
    Insert picture description here
  2. Client side synchronization verification
    Insert picture description here

Guess you like

Origin blog.csdn.net/qing1912/article/details/109053863