ZooKeeper pseudo-cluster installation

ZooKeeper pseudo-cluster installation

Pseudo-cluster is to install multiple zookeepers on one machine for learning and testing. …

 

A zookeeper cluster requires at least three, but two are not allowed, because the entire cluster can provide services only when the number of servers not less than quorum (2/3) is running normally.

 

 

1. Download zookeeper-3.4.9.tar.gz

 

2. Unzip, and copy out three copies and put them in zookeeper1, zookeeper2 and zookeeper3 respectively:



 

3. Create data and log storage directories. Here, simply store data and logs in their respective directories:

 

 

4. Modify the configuration file, and zookeeper1, 2, and 3 listen to ports 2181, 2182, and 2183 respectively.

The three modification processes are the same, and only zookeeper1 is demonstrated here.

The zookeeper configuration file is in conf/zoo.cfg. There is no such file by default. Just copy zoo_sample.cfg:

 

 

 Modify the content of the file as follows:


 

 The modified contents of zookeeper2 and zookeeper3 are as follows:

 

 


 

5. Create the myid file, and create the myid file in the data directory of zookeeper1, zookeeper2 and zookeeper3 respectively. The contents of the files are 1, 2, and 3:

 

 

 

6. Start, respectively run bin/skServer.sh start to start the 3rd brother zookeeper server:


 

 

Seeing three zookeeper processes means the startup is successful

 

7. Client connection, run bin/zkCli.sh under any zookeeper -server localhost:2181,localhost:2182,localhost:2183.

 

 

 Simple load balancing: The client connects to the servers in the connection string in random order, so a simple load balancing can be achieved with zookeeper, however, the client cannot specify the connection priority of the connection string puppet server, if you consider The network pressure between a zk node and the current client is relatively large. You can not write the server address of the zk node into the connection string. For example, in the above example, you can just write bin/zkCli.sh -server localhost:2181 , so that It is specified that the client is only connected to localhost:2181, which is more flexible

 

 

So far, the zookeeper pseudo-cluster is installed

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326987137&siteId=291194637