Zookeeper cluster deployment

Source: Internet
Author: User

Zookeeper cluster deployment

I. Preparations before deployment

1. Ensure normal communication between hosts, preferably in the same network segment.

2. Modify the host file and add the ing between the IP address and the host name. The method is to modify the/etc/hosts and etc/hostname files. The methods for different Linux distributions are not necessarily the same.

3. open the port to be used or close the Firewall

2. Deploy the Zookeeper Cluster

1. Visit the official website to download the Zookeeper installation package and decompress it.

Tar-xvzf zookeeper-3.4.6.tar.gz

2. Create a data directory

Run the following command to create a data directory:

Mkdir/usr/zookeeper/data

Run the following command to create a log directory:

Mkdir/usr/zookeeper/data/log

Run the following command to create the myid file and write the ID:

Echo 1>/usr/zookeeper/data/myid

3. modify configuration

Run the following command to edit the zoo. cfg file:

Cd zookeeper-3.4.6/conf/& mv zoo_sample.cfg zoo. cfg & vi zoo. cfg

Modify the configuration as follows:

DataDir =/usr/zookeeper/data

DataLogDir =/usr/zookeeper/data/log

Autopurge. snapRetainCount = 3

Autopurge. purgeInterval = 1

Add the node addresses of the Zookeeper cluster at the end:

Server.1 = node1: 2888: 3888

Server.2 = node2: 2888: 3888

Server.3 = node3: 2888: 3888

4. Copy the configuration file to another node.

Zookeeper-3.4.6/node2:/usr/

Note that the myid in each node cannot be the same.

3. Start the Zookeeper Cluster

Run the following command on each node of the Zookeeper cluster to start the Zookeeper service:

Zookeeper-3.4.6/bin/zkServer. sh start

Run the following command to view the status of each node in the Zookeeper cluster:

Zookeeper-3.4.6/bin/zkServer. sh status

The node node1 is a follewer node.

4. Verify HA's automatic failover

Run the jps command to view the Zookeeper process.

Use the kill-9 2432 command to kill the leader process, and then view the Zookeeper status of each node. If one of the nodes is leader, it is verified to be easy to use.

-------------------------------------- Split line --------------------------------------

Ubuntu 14.04 installs distributed storage Sheepdog + ZooKeeper

CentOS 6 installs sheepdog VM distributed storage

ZooKeeper cluster configuration

Use ZooKeeper to implement distributed shared locks

Distributed service framework ZooKeeper-manage data in a distributed environment

Build a ZooKeeper Cluster Environment

Test Environment configuration of ZooKeeper server cluster

ZooKeeper cluster Installation

Zookeeper3.4.6 Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

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.