& http: //www.aliyun.com/zixun/aggregation/37954.html "> Zookeeper is an Apache open source project, very common in the cluster management.Its cluster is also very simple to build, only need a simple configuration, Each node in the cluster will complete its own communication, automatically select Leader and so on.
More about zookeeper information and principles, you can refer to this post: ZooKeeper principle and make
Zookeeper stand-alone mode is more simple: In Ubuntu system, just need to perform sudo apt-get install zookeeper installation, and then to the installation directory to find the zkServer.sh script, execute ./zkServer.sh start to start zookeeper stand-alone mode, through The directory where zookeeper is installed this way is usually / usr / share / zookeeper /. By running zkServer.sh status you can see the running status of zookeeper, here is the stand-alone mode, it will display:
If it is on other Linux systems (CentOS), execute:
This directory has a zoo_sample.cfg file is provided by the official example of the configuration, the implementation of:
Copy a sample configuration, renamed zoo.cfg, start zookeeper:
Let us try to build zookeeper cluster, due to limited machines, I used to build a pseudo-cluster on a machine to build the cluster. zookeeper The number of officially recommended cluster nodes is odd, so here we are ready to build a cluster of three nodes. And then extract the downloaded zookeeper file to each directory: At the same time change the directory name:
Then enter the zookeeper directory of each node to create the data directory and the logs directory respectively: