Hadoop集群时间同步配置
Hadoop集群时间同步配置
- 1.时间服务器配置(必须root用户)
- 1.1检查ntp是否安装
- 1.2修改ntp配置文件
- 1.3修改/etc/sysconfig/ntpd 文件
- 1.4重新启动ntpd
- 1.5 其他机器配置(必须root用户)
- 1.6 编写定时任务
- 1.7 测试
- 2.返回目录
1.时间服务器配置(必须root用户)
1.1检查ntp是否安装
执行命令:rpm -qa|grep ntp
1.2修改ntp配置文件
执行命令:vi /etc/ntp.conf
1.修改1(授权192.168.1.0网段上的所有机器可以从这台机器上查询和同步时间):
修改前:
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
修改后:
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
2.修改2(集群在局域网中,不使用其他的网络时间):
修改前:
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
3.添加3(当该节点丢失网络连接,依然可以作为时间服务器为集群中的其他节点提供时间同步)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
1.3修改/etc/sysconfig/ntpd 文件
执行命令:vim /etc/sysconfig/ntpd
增加内容如下(让硬件时间与系统时间一起同步):
SYNC_HWCLOCK=yes
1.4重新启动ntpd
1.查看状态:service ntpd status
2.启动:service ntpd start
3.关闭:service ntpd stop
1.5 其他机器配置(必须root用户)
1.6 编写定时任务
在其他机器配置10分钟与时间服务器同步一次:crontab -e
编写定时任务如下:
*/10 * * * * /usr/sbin/ntpdate hadoop102
1.7 测试
修改任意机器时间(命令:date -s “2017-9-11 11:11:11”)。到十分钟后会自动同步整个集群服务器时间!!!
2.返回目录
总目录:https://blog.csdn.net/qq_39657909/article/details/84729209
版权声明:本博客为记录本人自学感悟,转载需注明出处!
https://me.csdn.net/qq_39657909
还没有评论,来说两句吧...