zookeeper集群搭建步骤:
四个节点以搭建完成hadoop集群
在节点master, slave01, slave02, slave03上部署zookeeper
1.把zookeeper安装包拖到master的/opt/soft文件夹下
2.安装包解压到/opt下
输入:
tar -zxvf soft/apache-zookeeper-3.5.7-bin.tar.gz
回车,解压成功
3. 修改apache-zookeeper-3.5.7-bin为zookeeper
输入
mv apache-zookeeper-3.5.7-bin zookeeper
4.进入zookeeper目录,创建zkData,进入zkData,创建myid文件
cd zookeeper
mkdir zkData
cd zkData
vi myid
在myid文件中填入编号1
5.进入/zookeeper下的/conf文件夹,修改zoo_sample.cfg名字为zoo.cfg
cd ..
cd conf
mv zoo_sample.cfg zoo.cfg
6.打开zoo.cfg,修改配置(内容安自己的目录和节点修改)
vi zoo.cfg
修改dataDir数据路径存储配置为自己的目录/opt/zookeeper/zkData
在末尾添加如下内容
###############cluster###################
server.1=master:2888:3888
server.2=slave01:2888:3888
server.3=slave02:2888:3888
server.4=slave03:2888:3888
7. 将/opt下的zookeeper文件复制到其他三台节点
scp -r /opt/zookeeper slave01:/opt/zookeeper
scp -r /opt/zookeeper slave02:/opt/zookeeper
scp -r /opt/zookeeper slave03:/opt/zookeeper
8. 分别将slave01,slave02, slave03节点的/opt/zookeeper/zkData/myid改为2,3,4
vi /opt/zookeeper/zkData/myid
9.在四个节点上分别启动zookeeper,在zookeeper目录下输入bin/zkServer.sh start
cd /opt/zookeeper
bin/zkSever.sh start
10.启动之后检查状态
配置完成