2. Zookeeper Cluster construction

Source: Internet
Author: User

Zookeeper Cluster construction

1.zookeeper Cluster Components:

There are three server roles in the Zookeeper cluster,

Leader (master) server,

Follower (slave) server,

Observer (from) server;


2.leader Special is that it has the right to decide, with the request Processor

(The difference between observer server and follower server is that they do not participate in the leader election)


3. Configuration file:

3.1 Modify zoo_sample.cfg to zoo.cfg configuration file (good remember)

/opt/zookeeper-3.4.6/conf under

MV Zoo_sample.cfg Zoo.cfg

3.2 Modifying a configuration file (zoo.cfg)

Datadir=/opt/zookeeper-3.4.6/data (need to create data directory)

server.1=z203 (server name): 2888 (follower and leader communication ports): 3888 (follower election leader Port)

server.2=Z204: 2,888:3,888

server.3=Z205: 2,888:3,888

3.3 In (Datadir=/opt/zookeeper-3.4.6/data) to create a myID file, which content is Server.1 in the 1 (SERVER.2 content is 2)

Z203 Server:

server.1=z203:2888:3888

such as entering the data directory to write commands echo "1" > myID

Z204 Server:

server.2=z204:2888: 3888

such as entering the data directory to write commands echo "2" > myID

Z205 Server:

server.3=z205:2888:3888

such as entering the data directory to write commands echo "3" > myID

3.4 Copy the configured zoo.cfg files to the other nodes

Scp-r/opt/zookeeper-3.4.5/zoo.cfg z204:/opt/zookeeper-3.4.5/

Scp-r/opt/zookeeper-3.4.5/zoo.cfg z205:/opt/zookeeper-3.4.5/

3.5 Note: Be sure to modify the contents of myID on other nodes

In Z204 should talk about myID content changed to 2 (echo "2" > myID)

In Z205 should talk about myID content changed to 3 (echo "3" > myID)

4. Start the cluster

Start separately (into the directory bin) ZK

./zkserver.sh Start

View status

./zkservice.sh Status


This article from "in order to finger that direction" blog, declined reprint!

2. Zookeeper Cluster construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.