Zookeeper cluster installation and zookeeper cluster Installation

Source: Internet
Author: User

Zookeeper cluster installation and zookeeper cluster Installation

Zookeeper is a highly reliable coordination system for large-scale distributed systems. Therefore, we can


Zookeeper is a coordination system, and its role object is a distributed system. So why?


Does a distributed system need a coordination system? The reason is as follows:


Developing a distributed system is often difficult and complex. The difficulties are mainly reflected in distributed systems.


System "partially failed ". "Partial failure" refers to the transfer of information between two nodes in the network.


If the network fails, the sender cannot know whether the receiver has received the message.


The cause of the fault is complex. The receiver may have received the information before a network error occurs.


Failed to receive, or the recipient's process died. The only way for the sender to obtain the real situation


Is to reconnect to the receiver and ask why the receiver is wrong. This is part of distributed system development.


Failed.


Zookeeper is a framework for solving "partial failures" of distributed systems. Zookeeper is not used for scoring


A distributed system avoids "partial failure", but allows a distributed system


Correctly handle such problems so that the distributed system can run normally. In other words, zookeeper is used to guarantee


The 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. Learn learner, including follower and observer. follower is used

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. However, the observer

If you do not participate in the voting process, only the leader status is synchronized. The observer aims to expand the system and improve

Read speed;


4. client: the requester.

Welcome to my personal website

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.