Easy Tutorial
❮ Programming Error Css En Cn Break Line ❯

3.0 Zookeeper Linux Server Cluster Setup Steps

Category Zookeeper Tutorial

This section will demonstrate the steps to set up a three-node Zookeeper server cluster.

The required preparatory work involves creating a virtual machine environment for three machines and installing the Java Development Kit (JDK). You can use VM or Vagrant + VirtualBox to set up a CentOS/Ubuntu environment. This example is based on a host machine with Windows 10 and uses Vagrant + VirtualBox to set up a CentOS 7 environment. If you are using cloud servers or physical machines, the process is similar.

Step One: Prepare three Zookeeper environments and download the Zookeeper package according to the previous tutorial. The three-cluster CentOS environments are as follows:

Machine One: 192.168.3.33

Machine Two: 192.168.3.35

Machine Three: 192.168.3.37

Tip: You can use the ifconfig command to check the IP address.

Step Two: Modify the zoo.cfg configuration information separately.

The roles of the three Zookeeper ports are:

Modify the cluster configuration file according to server.id = ip:port:port:

Add the following configurations at the end of the zoo.cfg file on the three virtual machines:

server.1=192.168.3.33:2888:3888
server.2=192.168.3.35:2888:3888
server.3=192.168.3.37:2888:3888

Configure the myid according to the id and the corresponding address:

vim /tmp/zookeeper/myid

After the configuration in this example, the query display is as follows:

Machine with IP 192.168.3.33 is configured with myid. Since this machine was started as a single machine in the previous tutorial, version-2 appears. It's okay if it doesn't.

Machine with IP 192.168.3.35 is configured with myid.

Step Three: Start the Cluster

Before starting, you need to turn off the firewall (in the production environment, you need to open the corresponding ports).

systemctl stop firewalld

Start 192.168.3.33 and check the logs. It is normal for errors to appear in the logs at this time because the other two machines have not started yet and cannot connect temporarily.

After starting the other two machines, check the status of the three machines:

IP 192.168.3.33

IP 192.168.3.35

IP 192.168.3.37

Finally, the cluster setup is successful! Mode: leader represents the master node, and follower represents the slave node, with one master and two slaves.

WeChat Follow

❮ Programming Error Css En Cn Break Line ❯