安装 zookeeper cluster

安装 zookeeper cluster

zookeeper-3.4.5.tar.gz
n0 10.69.10.193
n1 10.69.10.188
n2 10.69.10.192

n0 上解压 zookeeper-3.4.5.tar.gz

[hm@n0 ~]$ tar z-xvf zookeeper-3.4.5.tar.gz
[hm@n0 ~]$ ln -s zookeeper-3.4.5  zookeeper
[hm@n0 ~]$ vim zookeeper/conf/zoo.cfg
--------------------------
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=10.69.10.193:2888:3888
server.2=10.69.10.188:2888:3888
server.3=10.69.10.192:2888:3888
--------------------------
$sudo mkdir /var/lib/zookeeper
$sudo chown -R hm:hm  /var/lib/zookeeper
$sudo touch /var/lib/zookeeper/myid

$ echo 1 > /var/lib/zookeeper/myid //仅在n0上执行
$ echo 2 > /var/lib/zookeeper/myid //仅在n1上执行
$ echo 3 > /var/lib/zookeeper/myid //仅在n2上执行
===================================================
[hm@n0 ~]$scp -r 
zookeeper-3.4.5   
n1:/home/hm
[hm@n0 ~]$scp -r 
zookeeper-3.4.5   
n2:/home/hm

[hm@n1 ~]$ln -s  
zookeeper-3.4.5   zookeeper
[hm@n2 ~]$ln -s  
zookeeper-3.4.5   zookeeper
在n0,n1,n2三台机器上分别执行
zookeeper/bin/zkServer.sh start
zookeeper/bin/zkServer.sh status

==================
jps 显示进程 均为:QuorumPeerMain

[hm@n0 zookeeper]$ bin/zkServer.sh status
JMX enabled by default
Using config: /home/hm/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[hm@n0 zookeeper]$
[hm@n1 zookeeper]$ bin/zkServer.sh status
JMX enabled by default
Using config: /home/hm/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[hm@n1 zookeeper]$
[hm@n2 zookeeper]$ bin/zkServer.sh status
JMX enabled by default
Using config: /home/hm/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[hm@n2 zookeeper]$

http://heylinux.com/archives/2832.html

上一篇:4.2WebHost配置「深入浅出ASP.NET Core系列」


下一篇:洛谷——P1021 邮票面值设计