zookeeper multi-node configuration

First install zookeeper on each machine, here are two machines configured

192.168.1.222 and 192.168.1.223

Added in config file

tickTime=2000

initLimit = 10

syncLimit=5

dataDir=/appl/zookeeperdir/data

dataLogDir=/appl/zookeeperdir/log

clientPort=2181

server.1= 192.168.1.222:2888:3888

server.2= 192.168.1.223:2888:3888

 

The meaning of configuration items

In server.A=B:C:D, A is a number, indicating the server number, B is the IP address of the server, and the first port of C is used for information exchange among cluster members, indicating that the server is connected to the cluster. The port where the leader server exchanges information, D is the port used to elect the leader when the leader hangs

 

In addition to modifying the zoo.cfg file, in the cluster environment, an identification file myid must be added, which is placed in the dataDir folder.

Write directly with the echo command

On the 222 server

echo "1" > /appl/zookeeperdir/data/myid

 

Guess you like

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