Cluster time synchronization of hadoop under linux system

Reference: http://www.cnblogs.com/pipelone/archive/2009/06/17/1505002.html

yum is installed on common commands for uninstalling software: http://blog.csdn.net/kandyer/article/details/7941302

Time zone setting: http://blog.csdn.net/gtlions/article/details/7542932

 

Note 1:

①yum install ntp    

ntp is a service, install ntp service

②yum install ntpdate

ntpdate is a command that installs the ntpdate command, a command for time synchronization

 

Note 2:

Install and uninstall software using yum

①Use yum to install ntp service

yum install ntp

②Uninstall the software installed using yum

yum remove ntp

 

Note: Since the hadoop cluster has high time requirements, the hosts in the cluster must be synchronized frequently. This document is suitable for ubuntu, redhat series.

Note: Many contents are excerpted from the Internet, and then summarized after the test. If you have any questions, you can leave a message for discussion.

1. Set the host time to be accurate (any machine can be used). //If you don't need to synchronize the network time, you can omit this step

1.1 View the local time and time zone (date)

1.2 Set the time zone (tzselect; after selecting, execute cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime) (here is the modified time zone of redhat, ubuntu is relatively simple, the command is searched online)

1.3 Modification time (date -s 00:00:00 or network synchronization: apt-get install ntpdate; ntpdate cn.pool.ntp.org)

1.4 Write time to hard disk (hwclock -w)

This completes the host time setting.


 

2. Time synchronization (host)

Configure the host environment (yum install ntp ) (use centos as the host, refer to ubuntu time synchronization for settings)

•vi /etc/ntp.conf

add after

server 127.127.1.0  

Fudge 127.127.1.0 stratum 10

•关闭防火墙: #service iptables stop

•重新启动服务:

service ntpd stop(ubuntu是service ntp stop)

service ntpd start

这样主机准备完毕。

3.其他机器同步

•等待大概五分钟,再到其他机上同步该机器时间(先确保时区一样,否则同步以后时间也是有时区差的)

ntpdate IP地址(主机的)

Date查看时间是否同步完成。

4.根据需要,这里可以让分机器定时自动同步时间

4.1.yum install crontabs(atp-get)

4.2.crontab -e 编辑内容: * */12 * * * /usr/sbin/ntpdate 172.72.103.228(每12个小时更新一次,也可特定时间更新一次,格式可网上查找)

4.3保存退出即可,可以到/var/spool/mail/下查看记录

 

可能遇到的问题:no server suitable for synchronization found

参考:http://www.blogjava.net/spray/archive/2008/07/10/213964.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326895992&siteId=291194637