1. 集群规划

Hostname IP Functions 内存 磁盘
hdp-01 192.168.121.61 manager 4G 50G
hdp-02 192.168.121.62 master 3G 50G
hdp-03 192.168.121.63 worker 3G 50G
  • manager节点从标准时钟服务器同步时间,各节点从manager节点同步时间,当manager节点出现故障时,各节点从master节点同步时间。
    搭建ntp时间同步服务

2. 搭建ntp服务

# 在集群各个节点安装ntp服务
yum install -y ntp*

# 在manager节点修改:vim /etc/ntp.conf
restrict 192.168.120.2 mask 255.255.255.0 nomodify notrap
server ntp1.aliyun.com prefer
server 127.127.1.0
fudge 127.127.1.0 stratum 8
# 备注
192.168.120.2 和 255.255.255.0是集群所在网段的网关和子网掩码
ntp1.aliyun.com是主时钟源,我选择的是阿里的时钟源,可根据实际情况选择

# 在master节点修改:vim /etc/ntp.conf
restrict 192.168.120.2 mask 255.255.255.0 nomodify notrap
server hdp-01 prefer
server 127.127.1.0
fudge 127.127.1.0 stratum 9

# 在worker节点修改:vim /etc/ntp.conf
server hdp-01 prefer
server hdp-02

# 在manager启动ntp之后,其余各节点启动ntp服务之前,master和worker节点执行命令,同步manager时间
ntpdate hdp-01

# 查看ntp状态
ntpq -p
’*’ 表示当前使用的时钟源,’+’ 表示这些源可作为 NTP 源

# ntpstat查看ntp与上层ntp服务的联通性

搭建ntp时间同步服务
搭建ntp时间同步服务
搭建ntp时间同步服务

相关文章: