Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to build zookeeper Cluster

Shulou Source: shulou.com Published: 2022-06-01 01:05:29 09月22日 Update

The editor will share with you how to build a zookeeper cluster. I hope you will get something after reading this article. Let's discuss it together.

1 set up the cluster of zookeeper

1.1 zookeeper cluster requires at least 3 nodes (hadoop0,hadoop1,hadoop2) (Chapter 27 hadoop cluster construction), and the number is odd, and the time between nodes should be synchronized.

1.2 copy zookeeper.tar.gz on hadoop0, extract, rename, and set environment variables.

(1) copy zookeeper-3.4.tar.gz to the / usr/local directory, and then enter it

(2) execute the command tar-zxvf zookeeper-3.4.tar.gz to decompress

(3) rename mv zookeeper-3.4 zookeeper

1.3 enter zookeeper's conf directory on hadoop0

Mv zoo_sample.cfg zoo.cfg

1.4 go to the / usr/local/zookeeper/conf directory on hadoop0 and edit the file zoo.cfg

Change dataDir=/tmp/zookeeper to data=/usr/local/zookeeper/data

Add the following three lines:

Server.0=hadoop0:2888:3888

Server.1=hadoop1:2888:3888

Server.2=hadoop2:2888:3888

Create a folder on hadoop0 and execute the command mkdir-p / usr/local/zookeeper/data

1.5 under the data directory of hadoop0, create the file myid with a content of 0

Copy the zookeeper folder and / etc/profile on hadoop0 to the hadoop1,hadoop2 node.

1.7 execute source / etc/profile on hadoop1 and change the value of myid to 1

Execute source / etc/profile on hadoop2 and change the value of myid to 2

1.8 ssh to three nodes and execute the command zkServer.sh start on the three nodes

1. 9 Verification: execute jps on each node and find that one more java process is QuorumPeerMain.

After reading this article, I believe you have a certain understanding of "how to build a zookeeper cluster". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Clusters files directories nodes commands three folders articles between content variables odd dead time more environment knowledge industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei vpn Shulou Technology macOS NVidia