一.时间服务器设置
1.检查ntp 是否安装
执行 rpm -qa | grep ntp 命令,出现如下信息,则ntp已经安装,没有,则执行 yum -y install ntp 命令安装ntp
2.修改 /etc/ntp.conf 文件
(1)打开 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 将192.168.1.0改成自己的网关
(2)将所有的server关掉
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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
(3) 添加如下两行 (当该节点失去网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
3.修改 /etc/sysconfig/ntpd ,添加如下一行 (让硬件时间与系统时间一起同步)
SYNC_HWCLOCK=yes
4.启动ntpd服务
service ntpd start
二.让其他主机向hadoop100进行时间同步
/usr/sbin/ntpdate hadoop100
完成