Zookeeper cluster Installation

Source: Internet
Author: User

Zookeeper cluster Installation

Zookeeper is a highly reliable coordination system for large-scale distributed systems. Therefore, we can see that zookeeper is a coordination system, and its role is distributed systems. So why do distributed systems need a coordination system? The reason is as follows:

Developing a distributed system is often difficult and complex. The difficulties are mainly reflected in the "partial failure" of the distributed system ". "Partial failure" means that when information is transmitted between two nodes in the network, if the network fails, the sender cannot know whether the receiver has received the information, in addition, the cause of the fault is complex. The receiver may have received the information before a network error occurs, or the receiver's process may have died. The only way for the sender to obtain the real situation is to re-connect to the receiver and ask the recipient about the cause of the error. This is a "partially failed" issue in distributed system development.

Zookeeper is a framework for solving "partial failures" of distributed systems. Zookeeper does not allow the distributed system to avoid "partial failure", but allows the distributed system to correctly handle such problems when it encounters partial failure, so that the distributed system can run normally. In other words, zookeeper is used to ensure transaction consistency between zookeeper clusters.

So how should we deploy the zookeeper cluster?

1. The zookeeper server cluster has no less than three nodes, and the system time of each server must be consistent.

2. Download the zookeeper installation package: http://zookeeper.apache.org /.

3. In the/usr/local/directory of hadoop1, decompress the installation package and set environment variables, such:

4. Rename the file in the conf directory, for example:

5. edit the file and run vi zoo. cfg.

Modify dataDir as follows:

New:

6. Create a directory, run mkdir/usr/local/zk/data, and create the file myid in the directory, as shown below:

The value of myid is 0.

7. Copy the zk directory to hadoop2 and hadoop3 nodes as follows:

8. Change the value of myid in hadoop2 to 1, and the value of myid in hadoop3 to 2;

9. start. Run the zkServer. sh start command on the three nodes, as shown below:

10. Verify that the command zkServer. sh status is executed on the three nodes respectively, as shown below:

Zookeeper role

1. leader: The leader is responsible for initiating voting and making resolutions, and updating the system status;

2. learner: Includes follower and observer. follower is used to receive client requests, return results to the client, and participate in voting during the election process;

3. The observer can receive client connections and forward write requests to the leader. But the observer does not participate in the voting process and only synchronizes the leader status. The observer aims to expand the system, improve Reading speed;

4. client: the requester.

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.