赞
踩
1.下载安装包:wget https://archive.apache.org/dist/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz
2.解压安装包:tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz -C /usr/local/
3.修改配置文件
(1)创建数据目录 cd /usr/local/apache-zookeeper-3.6.2-bin && mkdir zkdata
(2)在zkdata目录中创建myid文件并写入编号:cd /usr/local/apache-zookeeper-3.6.2-bin/zkdata && touch myid && echo 1 > myid
(3)编写zk配置文件
进入到zk配置文件目录:cd /usr/local/apache-zookeeper-3.6.2-bin/conf
复制zk配置文件:cp zoo_sample.cfg zoo.cfg
修改配置:dataDir=/usr/local/apache-zookeeper-3.6.2-bin/zkdata
server.1=hadoop001:2888:3888
server.2=hadoop002:2888:3888
server.3=hadoop003:2888:3888
(4)复制安装文件到其他两台机器并修改myid编号
scp -r /usr/local/apache-zookeeper-3.6.2-bin/ hadoop002:/usr/local/
scp -r /usr/local/apache-zookeeper-3.6.2-bin/ hadoop003:/usr/local/
4.启动zk集群:进入到bin目录执行./zkServer.sh start
5.zk集群启动停止脚本
(1)在hadoop001的/usr/local/src/目录下创建脚本
[root@hadoop001 src]# vim zk.sh
在脚本中编写如下内容
(2)增加脚本执行权限
[root@hadoop001 src]# chmod 777 zk.sh
(3)zk集群启动脚本
[root@hadoop001 src]# ./zk.sh start
(4)zk集群停止脚本
[root@hadoop001 src]# ./zk.sh stop
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。