Linux cluster installation and set up Hadoop3.1.2 (9) - Cluster Time Synchronization (complete)

Chapter X: Cluster Time Synchronization

Time synchronized manner: find a machine, as a time server, all the machines are synchronized with the timing of this cluster time, for example, every ten minutes, a time synchronization.
Here Insert Picture Description
Specific configuration time synchronization operation:

  1. Configuration time server (must root)
    (1) Check whether the installation ntp
[root@hadoop104 ~]# rpm -qa|grep ntp
ntp-4.2.6p5-10.el6.centos.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch
ntpdate-4.2.6p5-10.el6.centos.x86_64

(2) modify the configuration file ntp

[root@hadoop104 ~]# vi /etc/ntp.conf

Modifications are as follows
a) Modification 1 (all machines on the network can query 192.168.1.0-192.168.1.255 authorization from this machine and synchronization time)

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap为
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

b) Amendment 2 (cluster LAN, do not use the time on other Internet)

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst为
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

c) adding 3 (node ​​when the network connection is lost, you can still use the local time of the time as a time server for other nodes in the cluster synchronization)

server 127.127.1.0
fudge 127.127.1.0 stratum 10

(3) modify / etc / sysconfig / ntpd file

[root@hadoop104 ~]# vim /etc/sysconfig/ntpd

Increase follows (let hardware time synchronization with the system time)

SYNC_HWCLOCK=yes

(4) to restart the ntpd service

[root@hadoop104 ~]# service ntpd status
ntpd 已停
[root@hadoop104 ~]# service ntpd start
正在启动 ntpd:                                            [确定]

(5) Set the ntpd service boot

[root@hadoop102 ~]# chkconfig ntpd on
  1. Other machine configuration (must be root)
    (1) disposed in the other machines 10 minutes with a time server
[root@hadoop105 ~]# crontab -e

Write regular tasks as follows:

*/10 * * * * /usr/sbin/ntpdate hadoop102

(2) modify any machine time

[root@hadoop105 ~]# date -s "2017-9-11 11:11:11"

If (3) Ten minutes later viewing machine synchronized with a time server

[root@hadoop105 ~]# date
Published 37 original articles · won praise 7 · views 1185

Guess you like

Origin blog.csdn.net/zy13765287861/article/details/104605084