Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux cluster time synchronization

Shulou Source: shulou.com Published: 2022-06-02 06:27:19 10月03日 Update

Time host (server side)

1. First check whether the ntp package is installed on the system

Rpm-Q ntp

-if you do not execute yum-y install ntp to install, then execute the above command to check

two。 Check to see if ntp is set to enable startup state:

Systemctl is-enabled ntpd

-if disable disables boot disabled by default, execute chkconfig ntpd on or set systemctl enable ntpd to boot.

3. Start the ntp service

Systemctl start ntpd.service

4. Edit ntp.conf

Vim ntp.conf

IP of the time server: 172.24.6.141

Execute vim / etc/ntp.conf to open the ntp configuration file, find the location of the server specified time server, comment out these bars, and then add the following two lines of fixed configuration:

Server 172.24.6.141

Fudge 172.24.6.141 stratum 10

Then add a line below the two lines specified by restrict: restrict 17 2. 24. 1 mask 255.255.25 5. 0 nomodify notrap (this configuration is based on your own gateway and network segment configuration, as long as you can ensure LAN host communication)

Once configured, save and exit, execute systemctl restart ntpd.service to restart the ntp service

6. View ntp status

Ntpq-p (ntpstat)

Client configuration

1. Also execute some of the above commands to install, start, self-boot configuration, status check and other operations on ntp. The configuration file is still / etc/ntp.conf, and open to configure as follows:

Also annotate the default server server, add a line to specify the time server location: server 172.24.6.141 because the above time server address is 172.24.6.141

Once configured, save and restart the ntp service

Systemctl restart ntpd.service

View ntp status

Ntpq-p (ntpstat)

All clients are configured above, and after they are started, the cluster will automatically synchronize the services on a regular basis, so that the time of the cluster is consistent.

Tags: Configuration service time server status cluster line host location command client client file comment check synchronization consistency address local area local area network Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi Apple Shulou Tech Info Docker