Today’s technology sharing is Hadoop cluster synchronization.
Choose a machine as a time server (hadoop01 is selected here), and all machines synchronize with the cluster time at regular intervals, such as once every 10 minutes.
Two. Tools needed
There are two time synchronization servers: ntpd and ntpdatp. Although time synchronization can be achieved by using both of them, it is necessary to clarify the difference between ntpd and ntpdate in updating time before using them. Ntpd is not only a time synchronization server, it can alsoTime synchronization between client and standard time server is smooth synchronization, not ntpdate immediate synchronization. In the production environment, ntpdate should be carefully used, so the two can not run at the same time.
III. Specific Operational Procedures
Time Server Configuration
(1)Check NTP installation. [root@hadoop01 Desktop]# rpm-qa | grep NTP if shown ntp-4.2.6p5-1.el6.centos.x86_64.font packaGes-filesystem-1.41-1.1.el6.noarch
ntpdate-4.2.6p5-1.el6.centos.x86_64It proves that NTP has been installed, otherwise NTP service should be installed first. [root@hadoop01 Desktop] # Yum install-y ntp.
(2)Modify the NTP configuration file [root@hadoop01 Desktop]#vi/etc/ntp.conf. Configure the client’s authorization first, that is, set access rights to NTP Server for the specified machine (client), through RThe estrict configuration item is implemented. Release #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap. Change to restrict 192.168.1.0 MASK 255.255.255.0 nomodify notrap. If the cluster is in a closed LAN, the default server can be blocked.
Ser0.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 iburstShield changed to
#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.Using the local clock of the local machine as the time supply source, it can continue to add server 127.127.1.0 fudge 127.127.1.0 stratum. Modify/etc/sysc even if it loses network connection.Onfig/ntpd file
[root@hadoop01 Desktop]# vim /etc/sysconfig/ntpdAfter adding SYNC_HWCLOCK=yes, restart ntpd, [root@hadoop01 Desktop]#service ntpd restart, and set the default startup of ntpd [root@hadoop01]Desktop] # chkconfig MTPD on. After completing the above operations, use the date command to see whether the system time corresponds to the current time, and if not, it should be a time zone problem. Modify the time zone [root@hadoop01 Desk]Top]# tzselect. Select the correct time zone according to the prompt, and then set cp/usr/share/zoneinfo/Asia/Shanghai to the link to/etc/localtime
[root@hadoop01 Desktop]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
IV. Other Machine Configuration
Configure to synchronize with the time server every 10 minutes
Time synchronization scripts need to be written on other machines in the cluster, for example, hadoop02, [root@hadoop02 Desktop] # crontab-e.*/10****usr/sbin/ntpd uuuuuuuuuuuuAte hadoop01
Restart the crond service. [root@hadoop02 Desktop] # service crond restart. If necessary, also modify the time zone, the operation is the same as above.
At this point, the end of the sharing, welcome you to discuss learning together! uuuuuuuuuuu