Cloudera 主机时钟偏差完美解决方案

 

CDH 集群需要保持各节点时间同步,需要在每个节点配置 NTP 时间同步服务

1、集群配置 NTP 主从时间同步服务

安装 NTP

yum install -y ntp

配置 /etc/ntp.conf 参数
ntp 时钟服务节点:在集群中配置一个 ntp 时间服务器,负责对内网其它节点提供时钟服务。
配置参数说明如下,完整配置脚本见清单中的 server-ntp.conf

 

# 设置对内网主机提供NTP服务,集群网关是192.168.20.1,允许内网其他机器同步时间 restrict 192.168.20.1 mask 255.255.255.0 nomodify notrap # 指定上层对时的外部服务器,优先选择阿里云的时钟服务 server time6.aliyun.com perfer server 0.cn.pool.ntp.org server 1.cn.pool.ntp.org server 2.cn.pool.ntp.org server 3.cn.pool.ntp.org #允许上层时间服务器主动修改本机时间 restrict time6.aliyun.com nomodify notrap noquery restrict 0.cn.pool.ntp.org nomodify notrap noquery restrict 1.cn.pool.ntp.org nomodify notrap noquery restrict 2.cn.pool.ntp.org nomodify notrap noquery restrict 3.cn.pool.ntp.org nomodify notrap noquery #外部时间服务器不可用时,设置以本地时间作为时间服务 server 127.127.1.0 fudge 127.127.1.0 stratum 10

ntp 子节点:配置参数与 ntp 时钟服务节点同步时间。
配置参数说明如下

 

# 指定上层对时的外部服务器,192.168.20.30为配置了ntpd时钟服务端的节点IP server 192.168.20.30 perfer server time6.aliyun.com #允许上层时间服务器主动修改本机时间 restrict 192.168.20.30 nomodify notrap noquery restrict time6.aliyun.com nomodify notrap noquery # 外部时间服务器不可用时,设置以本地时间作为时间服务 server 127.127.1.0 fudge 127.127.1.0 stratum 10

启用 ntp 服务

systemctl start ntpd systemctl enable ntpd

初始时间同步

ntpdate -u time6.aliyun.com

同步系统时间到硬件

hwclock --systohc

2、节点非正常开机启动时的主机时钟偏差问题解决

问题:在 Cloudera 集群中,节点意外宕机自动重启后,集群持续报告 主机时钟偏差 的告警信息,导致集群内一些服务无法正常提供服务。

原因:经排查测算后找到原因了,在服务器非正常启动后,cloudera-scm-agent 启动时,会检测 ntpd 服务是否启动,如果没有检测到 ntpd ,Cloudera 默认会以 chronyd 作为默认时间服务。然而系统并未配置 chronyd 服务,所以一直会出现 主机时钟偏差 的告警信息,服务器正常启动时不会出现该问题。
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值