ZooKeeper安装

master

1.下载源码包

https://archive.apache.org/dist/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz

[root@master src]# wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz

2. 解压至指定目录

[root@master src]# tar -zxvf zookeeper-3.4.11.tar.gz -C /usr/local/

3. 修改配置文件

[root@master local]# cd zookeeper-3.4.11

4. 创建日志文件夹及数据文件夹
 

[root@master zookeeper-3.4.11]# mkdir data
[root@master zookeeper-3.4.11]# mkdir log

5. 修改配置

[root@master local]# cd zookeeper-3.4.11/conf
[root@master conf]# mv zoo_sample.cfg zoo.cfg

vim zoo.cfg

dataDir=/usr/local/src/zookeeper-3.4.11/data
dataLogDir=/usr/local/src/zookeeper-3.4.11/log
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888

6. 配置环境变量
master、slave1、slave2

vim ~/.bashrc

ZOOKEEPER_HOME=/usr/local/src/zookeeper-3.4.11
PATH=$PATH:$ZOOKEEPER_HOME/bin

7. 刷新环境变量

[root@master conf]# source ~/.bashrc

8. 拷贝安装包

master

[root@master local]# scp -r zookeeper-3.4.11 root@slave1:/usr/local/src/
[root@master local]# scp -r zookeeper-3.4.11 root@slave2:/usr/local/src/

9. 分别添加ID

master

[root@master local]# echo "1" >  /usr/local/src/zookeeper-3.4.11/data/myid

slave1

[root@master local]# echo "2" >  /usr/local/src/zookeeper-3.4.11/data/myid

slave2

[root@master local]# echo "3" >  /usr/local/src/zookeeper-3.4.11/data/my

10. 启动ZooKeeper服务

master、slave1、slave2

[root@master zookeeper-3.4.11]# ./bin/zkServer.sh start

11. 查看运行状态

master

slave1

slave2

12. 进程状态

master

slave1

slave2

13. 关闭集群

master、slave1、slave2

[root@master zookeeper-3.4.11]# ./bin/zkServer.sh stop

你可能感兴趣的:(zookeeper,大数据分布式平台)