Zookeper三节点搭建(p_cluster1 p_cluster2 p_cluster3)
-
创建软件安装目录
mkdir /zookeeper && cd /zookeeper
mkdir data log -
下载zookeper并解压
下载地址:
https://www.apache.org/dyn/closer.cgi/zookeeper/
tar -xf zookeeper-3.4.6.tar.gz
cd zookeeper-3.4.6/ -
拷贝模板配置文件并修改
cp zoo_sample.cfg zoo.cfg
vim /zookeeper/zookeeper-3.4.6/conf/zoo.cfg
dataDir=/zookeeper/data
dataLogDir=/zookeeper/log
server.1=192.168.2.215:2888:3888
server.2=192.168.2.216:2888:3888
server.3=192.168.2.217:2888:3888 -
把zookerper目录传到另外两台节点
scp -r /zookeeper/* 192.168.2.216:/zookeeper/
scp -r /zookeeper/* 192.168.2.217:/zookeeper/ -
三个节点分别设置myid文件
P_cluster1:echo 1>/zookeeper/data/myid
P_cluster2:echo 2>/zookeeper/data/myid
P_cluster3:echo 3>/zookeeper/data/myid -
启动zookeper服务(三节点都要启动)
/zookeeper/zookeeper-3.4.6/bin/zkServer.sh start
/zookeeper/zookeeper-3.4.6/bin/zkServer.sh status -
设置环境变量
vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin:/mongodb/data/mongodb/bin:/zookeeper/zookeeper-3.4.6/bin
source /etc/profile