步骤
1. 检查ntp(网络时间协议)是否安装。
ps -e | grep ntp
如果出现一下内容表明一斤安装:

如果什么都没有,可以使用
sudo apt-get install ntp
进行安装。
2. 修改ntp配置文件
打开配置文件:sudo vim /etc/ntp.conf
2.1 授权集群中的机器可以访问这台机器的时间

2.2 集群在局域网中,不使用其它网络时间

2.3 当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其它节点提供时间同步

3. 修改/etc/sysconfig/ntpd
文件,让硬件时间与系统时间一起同步
4. 重新启动ntpd服务
service ntp restart
5. 设置htpd服务开机启动
6. 设置其它机器10分钟与时间服务器同步一次。
编写定时任务:
crontab -e
加入如下内容:
*/10 * * * * /user/sbin/ntpdate hadoop101
网友评论