node3
★
192.168.179.7
node4
★
192.168.179.8
node5
★
将zookeeper安装包上传到node3节点/software目录下并解压:
[root@node3 software]# tar -zxvf ./apache-zookeeper-3.6.3-bin.tar.gz
在node3节点配置环境变量:
#进入vim /etc/profile,在最后加入:export ZOOKEEPER_HOME=/software/apache-zookeeper-3.6.3-bin/export PATH=$PATH:$ZOOKEEPER_HOME/bin#使配置生效source /etc/profile
进入"$ZOOKEEPER_HOME/conf"修改zoo_sample.cfg为zoo.cfg:
[root@node3 conf]# mv zoo_sample.cfg zoo.cfg
配置zoo.cfg中内容如下:
tickTime=2000initLimit=10syncLimit=5dataDir=/opt/data/zookeeperclientPort=2181server.1=node3:2888:3888server.2=node4:2888:3888server.3=node5:2888:3888
[root@node3 software]# scp -r apache-zookeeper-3.6.3-bin node4:/software/[root@node3 software]# scp -r apache-zookeeper-3.6.3-bin node5:/software/
在node3,node4,node5各个节点上创建zoo.cfg中指定的数据目录"/opt/data/zookeeper"。
mkdir -p /opt/data/zookeeper
在node4,node5节点配置zookeeper环境变量
#进入vim /etc/profile,在最后加入:export ZOOKEEPER_HOME=/software/apache-zookeeper-3.6.3-bin/export PATH=$PATH:$ZOOKEEPER_HOME/bin#使配置生效source /etc/profile
在node3,node4,node5各个节点路径"/opt/data/zookeeper"中添加myid文件分别写入1,2,3:
#在node3的/opt/data/zookeeper中创建myid文件写入1#在node4的/opt/data/zookeeper中创建myid文件写入2#在node5的/opt/data/zookeeper中创建myid文件写入3
#各个节点启动zookeeper命令zkServer.sh start#检查各个节点zookeeper进程状态zkServer.sh status
这里安装HDFS版本为3.3.4,搭建HDFS对应的角色在各个节点分布如下: