zookeeper配置集群
zookeeper单点启动默认模式
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: standalone
配置集群
server.A=192.168.239.128:2888:3888
server.A=192.168.239.129:2888:3888
server.A=192.168.239.131:2888:3888
.......................................................
注意:最好保持奇数台服务器,以及配置最好放到一个git仓库中管理.
另:2台服务是无法选举出Leader,最少三台服务器.
创建myid
在dataDir=/opt/zookeeper/data创建一个文件myid,里面的内容与A对应
[root@localhost zookeeper-3.4.9]# ./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: leader
[root@localhost zookeeper-3.4.9]# ./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: follower