时间同步--ntp服务

今天尝试接手集群运维工作,上来就遇到了一个工作流中的任务调度失败,查看日志:

Master rejected startup because clock is out of sync.

org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server node4,16020,1639549230396 has been rejected; Reported time is too far out of sync with master. Time difference of 1928469ms > max allowed of 30000ms

报错原因:时间不同步。

集群中node4应该与node1保持一致,切使用的是ntp服务。

NTP服务

        NTP是网络时间协议(Network Time Protocol)的简称,就是用来同步网络中各个计算机的时间的协议。

NTP使用

1.永久修改主机名,固定一个专用名称,IP多了很难记得住

命令:hostnamectl set-hostname node4

2.关闭防火墙

命令:systemctl status firewalld.service

           systemctl stop firewalled.service

           systemctl disable firewalled.service

3.安装ntp服务

命令:yum -y install ntp

4.编写ntp配置文件

#编辑配置文件

vi /etc/ntp.conf

在配置文件中

driftfile /var/lib/ntp/drift

logfile /var/log/ntpd.log

server node1 prefer

fudge 127.127.1.0 stratum 10

 

5. 同步时间

ntpdate -u node1

6.启动并查看ntp服务

systemctl start ntpd

systemctl status ntpd

systemctl enable ntpd

7.查看当前时间

date

8.查看同步状态

ntpstat

返回:

synchronised to NTP server(IP) at stratum 5

        time correct to within 612 ms

        polling server every 256s

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值