Hadoop3集群搭建之——配置ntp服务

上篇:

Hadoop3集群搭建之——虚拟机安装

Hadoop3集群搭建之——安装hadoop,配置环境

  安装好的的虚拟机,发现时间不一致,相差还比较大,对于hadoop集群来说,是需要时间同步的。

  这个时候,就需要一个ntp服务了。

  1、在各个节点上安装ntp    

yum install ntp

  2、在各个节点上设置时区为 亚洲上海  

timedatectl set-timezone Asia/Shanghai

  3、在各个节点启动ntp服务,依次执行以下命令 

systemctl start ntpd
systemctl enable ntpd

  4、在master上设置当前时间  

timedatectl set-ntp no
timedatectl set-time HH:MM:SS 
timedatectl set-ntp yes

  5、在master上配置ntp服务

  

[hadoop@venn05 ~]$ vim /etc/ntp.conf
[hadoop@venn05 ~]$ more /etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1   # ntp服务器指向自己
restrict ::1
restrict 192.168.0.0 mask 255.255.0.0  # 接受 192.168 段客户端

  6、master上重启ntp服务  

systemctl restart ntpd 

  7、在其他节点同步master的时间  

[root@venn08 hadoop]# ntpdate venn05
25 Apr 23:23:48 ntpdate[1430]: step time server 192.168.1.5 offset -1.082561 sec

  8、在其他节点启动ntp服务  

systemctl start ntpd
systemctl enable ntpd

  9、同步所以节点时间  

timedatectl set-ntp yes

搞定

上篇:

Hadoop3集群搭建之——虚拟机安装

Hadoop3集群搭建之——安装hadoop,配置环境

猜你喜欢

转载自www.cnblogs.com/Springmoon-venn/p/8948143.html