Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build zookeeper Cluster

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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

Zookeeper cluster building 1. Environment at the time of building

CentOS 6.5

Zookeeper-3.4.6.tar.gz

Jdk-7u25-linux-x64.gz

2. Install the virtual machine

After decompressing vmware_bestgood_32 (64) _ cn, find VMware-workstation-full-9.0.0-812388 and install it directly. After successful installation, click File and select open to find CentOS64-bit under the CentOS64_Master folder. After starting the virtual machine.

A similar method opens CentOS64-bit three times. Start up so that you can simulate three machines.

The hostnames are wbx1, wbx2, and wbx3.

Enter user name and password

3. Install Zookeeper cluster

View the ip: ifconfig of the linux virtual machine

Wbx1:ip address: 192.168.102.135

Wbx2:ip address: 192.168.102.130

Wbx3:ip address: 192.168.102.132

Use the tool XShell to enter instructions to connect to the virtual machine: ssh 192.168.102.135 root zhouzhiyong

3.1Configuring hosts to test node connectivity

(1) configure hosts:

Vi etc/hosts (press shift plus colon and enter wq! Force save exit)

(2) Test network connectivity:

Ping wbx1

3.2download, extract the installation package zookeeper-3.4.6.tar.gz

(1) download the Zookeeper-3.4.6.tar.gz address http://www.apache.org/dist/zookeeper/

(2) We put it in a folder under Linux, and here I put it under / user/lcoal

Then decompress: tar zxvf zookeeper-3.4.6.tar.gz

Create the project directory and move the extracted directory to the Zookeeper subdirectory in the project directory

3.4 modify Zookeeper configuration file zoo.cfg

(1) there is a file zoo_sample.cfg under the corresponding zookeeper-3.4.6/conf. This file configures some information such as the port to listen for client connections. When Zookeeper starts, it will find zoo.cfg as the default configuration file, so we copy a file named zoo.cfg.

Cp conf/zoo_sample.cfg conf/zoo.cfg

(2) modify the zoo.cfg configuration information to

TickTime=2000

InitLimit=10

SyncLimit=5

DataDir=/usr/wbx/zookeeper/zkdata

DataLogDir=/usr/wbx/zookeeper/logs

ClientPort=2181

Server.1=wbx1:2888:3888

Server.2=wbx2:2888:3888

Server.3=wbx3:2888:3888

(3) description:

ClientPort: the port that listens for client connections.

TickTime: basic event unit, in milliseconds. It is used to control heartbeats and timeouts, and by default the minimum session timeout is twice the tickTime.

We can configure the port of the configuration file, etc., or do advanced configuration and cluster configuration, for example: maxClientCnxns: limit the number of clients connected to ZooKeeper, etc.

3.5 Establishment of Zookeeper Node Identification File myid

[root@wbx1 zookeeper-3.4.6] # echo "1" > / usr/wbx/zookeeper/zkdata/myid

3.6 configure environment variables and make them take effect immediately

[root@wbx1 zookeeper-3.4.6] # vim / etc/profile

Export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6

Export PATH=$ZOOKEEPER_HOME/bin:$PATH

Let the configuration take effect

. / etc/profile

3.7 start

Start three machines in turn

Start bin/zkServer.sh start

3.8 View status

Bin/zkServer.sh status

3.9 close

Bin/zkServer.sh stop

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report