|NO.R.00004|——————————|Navigation|————|服务启动导航.v04|————|NTP.v04|时间同步服务器配置:方案二|

一、安装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 status 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

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(20)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示