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