Hadoop cluster time synchronization

1. Cluster time synchronization
Find a machine, as a practical server, all machines will synchronize with the cluster time regularly, for example, synchronize the time every ten minutes.
1.1 Steps
1.1.1 Time server configuration

[[email protected] hadoop-2.7. 7]$ rpm -qa | grep ntp

ntp
-4.2.6p5-28.el7.centos.x86_64
ntpdate
-4.2.6p5-28.el7.centos.x86_64
[[email protected] hadoop
-2.7.7 ]$ vim /etc/ntp.conf
#Authorization 172.
16.0.0/All machines in the 16 network segment can query the time from this machine
restrict
172.16.0.0 mask 255.255.0.0 nomodify notrap
#The cluster is in the local area network and does not use his time on the Internet
server
0.centos.pool.ntp.org iburst
#When the node loses network connection, the local time can still be used as a time server to provide time synchronization for other nodes in the cluster
server
127.127.1.0
fudge
127.127.1.0 stratum 10

1.1.2 Modify /etc/sysconfig/ntpd file

[ [email protected] hadoop-2.7.7]$ vim /etc/sysconfig/< span style="color: #000000;">ntpd

#Add the following content to synchronize the hardware time with the system time
SYNC_HWCLOCK=yes

1.1.3 Restart ntpd service

[[emailprotected] hadoop -2.7.7]$ systemctl enable ntpd

[[email protected] hadoop
-2.7.7 ]$ systemctl restart ntpd

1.1.4 Other machine configuration

[[emailprotected] hadoop-2.7.7]$ crontab -e

*/10 * * * * /usr/sbin/ntpdate hadoop01
#Modify any time at will, wait for 10 minutes to see if it is synchronized with the practice of hadoop01 machine
[[email protected] hadoop
-2.7.7 ]$ date -s " 2019-8-4 11:27:30"
[[email protected] hadoop
-2.7.7 ]$ date
[[email protected] hadoop
-2.7.7 ]$

[[email protected] hadoop-2.7.7]$ rpm -qa | grep ntp

ntp
-4.2.6p5-28.el7.centos.x86_64
ntpdate
-4.2.6p5-28.el7.centos.x86_64
[[email protected] hadoop
-2.7.7 ]$ vim /etc/ntp.conf
#Authorization 172.
16.0.0/All machines in the 16 network segment can query the time from this machine
restrict
172.16.0.0 mask 255.255.0.0 nomodify notrap
#The cluster is in the local area network and does not use his time on the Internet
server
0.centos.pool.ntp.org iburst
#When the node loses network connection, the local time can still be used as a time server to provide time synchronization for other nodes in the cluster
server
127.127.1.0
fudge
127.127.1.0 stratum 10

[[email protected] hadoop-2.7 .7]$ vim /etc/sysconfig/ntpd

#Add the following content to synchronize the hardware time with the system time
SYNC_HWCLOCK
=yes

[[email protected] hadoop-2.7. 7]$ systemctl enable ntpd

[[email protected] hadoop
-2.7.7 ]$ systemctl restart ntpd

[[email protected] hadoop-2.7.7]$ crontab -e

*/10 * * * * /usr/sbin/ntpdate hadoop01
#Modify any time at will, wait for 10 minutes to see if it is synchronized with the practice of hadoop01 machine
[[email protected] hadoop
-2.7.7 ]$ date -s " 2019-8-4 11:27:30"
[[email protected] hadoop
-2.7.7 ]$ date
[[email protected] hadoop
-2.7.7 ]$

Leave a Comment

Your email address will not be published.