About the cluster construction of zookeeper

After installing zookeeper on all machines, start building the cluster

1. Modify the ../zookeeper/conf/zoo.cfg file

tickTime=2000
dataDir=/usr/local/zookeeper/data
clientPort=2181
initLimit = 5
syncLimit=2
server.1=IP1:2888:3888
server.2=IP2:2888:3888
server.3=IP3:2888:3888

2. Create directories on all machines: 

  /usr/local/zookeeper/data

3. respectively in

  Create a myid file in the /usr/local/zookeeper/data directory on the IP1 machine with the content 1: echo 1 > myid

  Create a myid file in the /usr/local/zookeeper/data directory on the IP2 machine with the content 2: echo 2 > myid

  Create a myid file in the /usr/local/zookeeper/data directory on the IP3 machine with the content 3: echo 3 > myid

  ......,

  It must be in one-to-one correspondence with the server configuration of the zoo.cfg configuration file,

4. Start all zk

  ./zookeeper/bin/zkServer.sh start

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324691050&siteId=291194637