SS00002.spark——|服务启动导航.v02|————|NTP.v02|时间同步服务器配置:方案二|

本文档详细介绍了在hadoop集群中安装和配置NTP服务的过程,包括在hadoop01、hadoop02和hadoop03节点上安装ntp服务,修改配置文件以设置hadoop01作为ntp服务器,其他节点作为客户端同步时间,并验证了时间同步的正确性和精度。此外,还强调了时间同步对于Kudu等对时间敏感的服务的重要性。
摘要由CSDN通过智能技术生成
一、安装ntp服务
### --- 安装ntp服务

~~~     # hadoop01、hadoop02、hadoop03安装ntp服务:
[root@hadoop01 ~]# yum -y install ntp
### --- 配置文件修改

~~~     # 修改ntp.conf配置文件:hadoop01、hadoop02、hadoop03
[root@hadoop01 ~]# vim /etc/ntp.conf
 ~~~所有主机注释掉这四行:21~24行
# 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
### --- 修改ntp-server:192.168.1.121服务器配置文件:

~~~     # 以hadoop01作为ntp-server服务器:修改hadoop01:192.168.1.121节点上的配置文件
[root@hadoop01 ~]# vim /etc/ntp.conf
 
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap     # 第18行:给192.168.1.0网段,子网掩码为255.255.255.0的局域网机的机器有同步时间的权限
server 192.168.1.121 prefer                                 # 第26行:prefer代表优先使用此ip做同步
server 127.127.1.0                                          # 第27行:当所有服务器都不能使用时,使用本机作为同步服务器
fudge 127.127.1.0 stratum 10                                # 第28行
### --- 修改ntp-client:192.168.1.122和192.168.1.123节点上的配置文件

~~~     # 修改ntp-client:hadoop02、hadoop03配置文件
[root@hadoop02 ~]# vim /etc/ntp.conf
~~~第25~27行添加如下内容
server 192.168.1.121 prefer
server 127.127.1.0
fudge 127.127.1.0 stratum 10
### --- 启动NTP服务

~~~     # 所有主机:hadoop01、hadoop02、hadoop03启动ntp服务
[root@hadoop01 ~]# systemctl start ntpd
[root@hadoop01 ~]# systemctl enable ntpd
### --- 检验

~~~     # 所有主机:时间同步验证:检查ntp服务是否成功输入:ntpstat:输出如下则启动成功并且同步已完成
[root@hadoop01 ~]# ntpstat
synchronised to local net (127.127.1.0) at stratum 11
   time correct to within 3948 ms
   polling server every 64 s
   
[root@hadoop02 ~]# ntpstat
synchronised to NTP server (192.168.1.121) at stratum 12
   time correct to within 55 ms
   polling server every 64 s
   
[root@hadoop03 ~]# ntpstat
synchronised to NTP server (192.168.1.121) at stratum 12
   time correct to within 55 ms
   polling server every 64 s
### --- 在所有主机效验时间效验

~~~     # systemctl status ntpd.service 各个节点检查启动成功:hadoop01、hadoop02、hadoop03
~~~     # 否则启动kudu相关服务会报错时钟同步,kudu对时间要求很精准
[root@hadoop01 ~]# ntpdate -u ntp.api.bz
[root@hdp-1 kudu]# systemctl status ntpd.service
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值