zookeeper集群安装

一。介绍
1.zookeeper集群的各个节点
192.168.0.139   zookeeper1
192.168.0.140   zookeeper2
192.168.0.141   zookeeper3


二。3个节点相同的安装及配置
1. 每个节点安装软件
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz


cp -r zookeeper-3.4.6 /usr/local/


环境变量:
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6
export PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin


2.每个节点做以下配置
# pwd
/usr/local/zookeeper-3.4.6/conf
# cat zoo_sample.cfg |grep -v ^# |grep -v ^$ > zoo.cfg
mkdir -p /data/zookeeper/data


vi  zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper/data
clientPort=2181
server.1=192.168.0.139:2888:3888
server.2=192.168.0.140:2888:3888
server.3=192.168.0.141:2888:3888


3.每个节点执行
chmod +x /usr/local/zookeeper-3.4.6/bin/*.sh




三.设置myid


节点1
echo "1" >/data/zookeeper/data/myid
节点2
echo "2" >/data/zookeeper/data/myid
节点3
echo "3" >/data/zookeeper/data/myid


四。各个节点启动


每个节点都执行。
zkServer.sh start


五。各个查看状态


[root@zookeeper1 ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower


[root@zookeeper2 ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader


[root@zookeeper3 ~]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower


至此ZOOKEEPER集群安装完成

你可能感兴趣的:(zookeeper,zookeeper)