Network Time Protocol (NTP, Network Time Protocol) is used to synchronize all of its client clock services. The NTP server synchronizes the clock of the local system with a public NTP server and then serves as a time host so that all clients on the local network can synchronize the clock.
The biggest benefit of clock synchronization is the data in the log files on the relevant system. If you use the central log host to centrally manage logs in the network, the log results will better reflect the real situation. In a network that synchronizes the clock, the centralized performance monitoring and service monitoring systems can reflect system information in real time, and the system administrator can quickly detect and solve system errors.
1. Configure the client
# Synchronize local and remote server time on one machine
//Install ntpdate
Yum install ntpdate
Ntpdate can be directly installed by rpm without any dependency
Rpm-IVH http://mirrors.aliyun.com/centos/7.5.1804/ OS /x86_64/Packages/ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm
// Synchronize time with remote machines
# Ntpdate ntp1.aliyun.com 19 Oct 10:07:54 ntpdate [17142]: adjust time server 120.25.115.20 offset 0.026562 Sec
// The automatic synchronization time can be implemented when writing data.
# Echo "*/5 *****/usr/sbin/ntpdate ntp1.aliyun.com>/dev/null 2> & 1">/var/spool/cron/root
# Crontab-l
*/5 */usr/sbin/ntpdate ntp1.aliyun.com>/dev/null 2> & 1
2. Set NTP time for the server
# Synchronize the time in the Cluster
1. Install NTP
[[Email protected] ~] # Yum install NTP
2. Start the ntpd service
[[Email protected] ~] # Systemctl start ntpd
[[Email protected] ~] # Systemctl enable ntpd
3. Synchronize NTP time servers with other Intranet machines
[[Email protected] ~] # Yum install ntpdate-y
[[Email protected] ~] # Date-s '123'
[[Email protected] ~] # Ntpdate 172.16.1.61
[[Email protected] ~] # Date
Fri Oct 19 10:35:35 CST 2018
Achieve cluster-NTP Time Synchronization