|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 2022-04-17 16:15  yanqi_vip  阅读(28)  评论(0)    收藏  举报

导航