zookeeper build a simple cluster

1. Download (binaries, source code needed to download version) from the open source Apache official website
https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/

2. Download the binary version of
apache-zookeeper-3.5.6-zookpeeper- bin

3. directly into the directory you want to install
/ home / virtul-cluster-zookeeper /

Configuring zoo.cfg
tickTime = 2000
initLimit = 10
syncLimit =. 5
dataDir = / Home / virtul-Cluster-ZooKeeper / Apache-ZooKeeper-bin-3.5.6-zookpeeper1 / ZooKeeper
the clientPort = 2181
server.1 = 127.0.0.1: 2882: 3882
server.2 = 127.0.0.1: 2883: 3883
server.3 = 127.0.0.1: 2884: 3884
created myid content directory at $ 1 dataDir myid three nodes (l, 2,3)
before 5. start configuration JAVA environment variables
export JAVA_HOME = / home / jdk1.8.0_131
or echo "export JAVA_HOME = / home / jdk1.8.0_131" >> / etc / profile && source / etc / profile

6. Start ZooKeeper
./bin/zkServer.sh Start

7. Review the status
./bin/zkServer.sh status

Note:
server.x 1.zoo.cfg in the value of x corresponds myid
2.dataDir directory to be configured correctly
3.zookeeper need to run JAVA_HOME environment variable
4. To remove the cluster becomes a stand-alone comment zoo.cfg other server.x
server.1 = 127.0.0.1 #: 2882: 3882
# server.2 = 127.0.0.1: 2883: 3883
# server.3 = 127.0.0.1: 3884: 2884
after starting zookeeper state: Mode: standalone

Guess you like

Origin blog.51cto.com/13396187/2447826