HBase出现Reported time is too far out of sync with master

一、错误日志

Server slave1.cdh,16020,1657157836878 has been rejected; Reported time is too far out of sync with master.  Time difference of 73287ms > max allowed of 30000ms

二、原因分析

  HBase的Regoin节点与Master节点时间对应不上,超过了指定的时间范围,使用date命令查看各自的时间,可发现Regoin节点时间慢了一分钟。

三、解决

  配置时间同步即可

1、Master节点

(1)关闭ntp服务和自启动

sudo systemctl stop ntpd
sudo systemctl disable ntpd

(2)修改ntp配置文件

sudo vim /etc/ntp.conf

    修改内容如下:

      a)修改1(授权192.168.1.0-192.168.1.255网段上的所有机器可以从这台机器上查询和同步时间)

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
改为
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

      b)修改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
复制代码

      c)添加3(当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步)

server 127.127.1.0
fudge 127.127.1.0 stratum 10

(3)修改/etc/sysconfig/ntpd 文件

sudo vim /etc/sysconfig/ntpd

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

SYNC_HWCLOCK=yes

(4)重新启动ntpd服务

sudo systemctl start ntpd

(5)设置ntpd服务开机启动

sudo systemctl enable ntpd

2、Regoin子节点

(1)关闭ntp服务和自启动

sudo systemctl stop ntpd
sudo systemctl disable ntpd

(2)开启定时任务,10分钟向Master节点同步一次数据

sudo crontab -e

填写如下内容:

*/10 * * * * /usr/sbin/ntpdate Regoin节点IP地址

(3)测试时间同步是否生效

  修改任意机器时间

date -s "2020-5-14 12:12:12"

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

date

 

posted @ 2022-07-07 10:27  宜家数据小哥  阅读(220)  评论(0编辑  收藏  举报