配置集群NTP时间同步服务

1、master中执行以下操作

# 安装ntp
yum -y install ntp

# 配置ntp        
# vi /etc/ntp.conf            

# 注释或者删除以下4行
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 127.127.1.0
fudge 127.127.1.0 stratum 10

# 启动并加入开机自启服务
systemctl start ntpd
systemctl enable ntpd

2、修改/etc/sysconfig/ntpd 文件

vi /etc/sysconfig/ntpd

  增加内容如下(让硬件时间与系统时间一起同步)

SYNC_HWCLOCK=yes

3、重新启动ntpd服务

service ntpd status

service ntpd start

4、设置ntpd服务开机启动

chkconfig ntpd on

5、其他机器配置(必须是root用户)

(1)在其他机器配置10分钟与时间服务器同步一次

crontab -e

编写定时任务如下:

*/10 * * * * /usr/sbin/ntpdate 时间同步服务器主机名

(2)修改任意机器时间

date -s "2017-9-11 11:11:11"

(3)十分钟后查看机器是否与时间服务器同步

        date

说明:测试的时候可以将10分钟调整为1分钟,以节省时间。

6、所有slave从节点中执行以下操作

# 安装
yum -y install ntpdate

# 设置开机启动
systemctl enable ntpdate

# 时间同步
ntpdate master.hadoop

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黄金矿工Kingliu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值