Source: http://blog.csdn.net/jiangheng0535/article/details/10287609
Description: Due to the high time requirement of Hadoop cluster, the hosts in the cluster should be synchronized frequently. This document is suitable for Ubuntu, Redhat series.
Note: A lot of content is in the online excerpt, and then after the test summary, if there is doubt can leave a message to discuss.
1. Set the host time accurately (any machine can). //If you do not need to synchronize network time, you can omit this step
1.1 View native time and time zone (date)
1.2 Set time zone (tzselect; execute cp/usr/share/zoneinfo/asia/shanghai/etc/localtime after selection ) (This is Redhat's modified time zone, Ubuntu is easier, Command Online search)
1.3 Modification Time (date-s 00:00:00 or network sync:apt-get install ntpdate; ntpdate cn.pool.ntp.org)
1.4 Write Hard Disk Time (hwclock-w)
This completes the host time setting.
2. Time synchronization (host )
Configuring the Host Environment (yum install NTP) ( also available with Ubuntu Master, set reference ubuntu time sync)
•vi/etc/ntp.conf
Add in the back
Server 127.127.1.0
Fudge 127.127.1.0 Stratum 10
• Turn off firewall: #service iptables Stop
• Restart the service:
Service ntpd Stop (Ubuntu is service NTP stop)
Service NTPD Start
This way the host is ready to complete.
3. Synchronization of other machines
• Wait for about five minutes, then sync the machine time to another machine (make sure the time zone is the same, otherwise the timing is sometimes bad)
Ntpdate IP address (host)
Date to see if the time is complete synchronously.
4. Depending on the need, this allows the machine to synchronize time automatically.
4.1.yum Install Crontabs (atp-get)
4.2.crontab-e Edit content: * */12 * * * */usr/sbin/ntpdate 172.72.103.228 ( updated every 12 hours, also can be updated at a specific time, the format can be found online)
4.3 Save to exit, you can view the record under/var/spool/mail/
Linux Cluster time synchronization