Zookeeper是Apache的一个开源项目,在集群管理中十分常用。它的集群搭建也十分简单,只需要简单的配置,集群的各个节点会完成自行通讯,自动选取Leader等。
更多关于zookeeper的信息和原理,可以参考这篇博文:ZooKeeper原理及使用
JMX enabled by default Using config: /etc/zookeeper/conf/zoo.cfg Mode: standalone
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz tar zxf zookeeper-3.4.6.tar.gz cd zookeeper-3.4.6/conf/
cp ./zoo_sample.cfg zoo.cfg
../bin/zkServer.sh start
mkdir server0 mkdir server1 mkdir server2
tar xzvf zookeeper-3.4.6.tar.gz -C ./server0/ tar xzvf zookeeper-3.4.6.tar.gz -C ./server1/ tar xzvf zookeeper-3.4.6.tar.gz -C ./server2/
mv ./server0/zookeeper-3.4.6 ./server0/zookeeper mv ./server1/zookeeper-3.4.6 ./server1/zookeeper mv ./server2/zookeeper-3.4.6 ./server2/zookeeper
mkdir data mkdir logs
vim ./data/myid
vim ./zoo.cfg
./bin/zkServer.sh start
JMX enabled by default Using config: /opt/zookeeper/server0/zookeeper/bin/../conf/zoo.cfg Mode: follower
./bin/zkCli.sh -server 127.0.0.1:2181