Linux system Transport Koriyuki zookeeper cluster configuration

Source: Internet
Author: User
Tags ack zookeeper

First, Introduction

Zookeeper is a distributed, open source distributed application Coordination Service that is an open source implementation of Google's chubby and an important component of Hadoop and HBase. The goal of zookeeper is to encapsulate complex and error-prone services that provide users with easy-to-use interfaces and performance-efficient, robust systems.

1. The basic operating process of the Zookeeper 1, the election leader, the election mechanism is more than 1/2.  2. Synchronize data.  3. There are many algorithms in the process of election leader, but the election standards to be met are consistent.  4, leader to have the highest execution ID, similar to root permissions. 5, most of the machines in the cluster get response and follow selected leader. 2. Leader Work Flow

Leader has three main functions:

1. Recover data; 2. Maintain heartbeat with learner, receive learner request and Judge learner request message type; The message type of 3.Learner is mainly ping message, request message, ACK message, revalidate message, Depending on the message type, different processing is performed. The ping message refers to the heartbeat information of the learner, the request message is the proposed information sent by follower, including write requests and synchronization requests, the ACK message is follower's reply to the proposal, more than half of the follower passed, then commit the proposal The revalidate message is used to extend the session's effective time. 3. Follower Work Flow

Follower has four main functions:

1. Send the request (Ping message, request message, ACK message, revalidate message) to the Leader 2. Receive the leader message and process it; 3. Receive client's request, send to leader to vote for write request, 4. Returns the client result.

The follower message loop handles the following messages from leader:

1.PING message: Heartbeat message 2.PROPOSAL message: Leader initiated proposal, request follower poll 3.COMMIT message: server-side information about the latest proposal 4.UPTODATE message: Indicates that synchronization is complete 5. Revalidate message: According to Leader's revalidate results, close the session to be revalidate or allow it to accept the message 6.SYNC message: Return sync results to the client, the message was originally initiated by the client,    Used to force the latest updates. More information: http://www.cnblogs.com/felixzh/p/5869212.html, installation configuration 1. Environmental information
IP:192.168. 10.10 hostname:lfto-zookeeper01ip:192.168. 10.11 hostname:lfto-zookeeper02ip:192.168. 10.12 hostname:lfto-zookeeper03
2. Installation Configuration

Installing the JDK Infrastructure environment

[Email protected] ~]$ cd/home/worker/soft/[[Email protected]-zookeeper01 soft]$wgethttp//10.12.3.24/soft/jdk/jdk1.8.0_65.tar.gz[Email protected] soft]$mkdir-p/home/worker/usr/local/[[Email protected]-zookeeper01 soft]$TarXF Jdk1.8.0_65.Tar. gz-c/home/worker/usr/local/[[Email protected]-zookeeper01 soft]$LN-s/home/worker/usr/local/jdk1.8.0_65/home/worker/usr/local/Jdk[[email protected]-zookeeper01 soft]$ Vim ~/. bash_profile######## #JDK env######## #export java_home=/home/worker/usr/local/Jdkexport CLASSPATH= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/Libexport PATH= $JAVA _home/bin: $JAVA _home/jre/Bin: $PATH Effective environment variable [[email protected]-zookeeper01 soft]$ Source ~/.bash_profile

Installing zookeeper, configuring a single point

[Email protected] soft]$wgethttp//10.12.3.24/upload/zhaobin/zookeeper/zookeeper-3.4.6.tar.gz[Email protected] soft]$TarXF zookeeper-3.4.6.Tar. gz-c ~/opt/[[Email protected]-zookeeper01 soft]$ CD ~/opt/zookeeper-3.4.6/Conf[[email protected]-zookeeper01 conf]$CPzoo_sample.cfg zoo.cfg# Modify configuration file [[email protected]-Zookeeper01 conf]$ vim zoo.cfgdatadir=/home/worker/opt/zookeeper_data/#创建数据目录 [[email protected]-zookeeper01 conf]$mkdir-p/home/worker/opt/zookeeper_data/

Shut down, start, restart service, etc.

[Email protected] conf]$/home/worker/opt/zookeeper-3.4. 6/bin/zkserver. sh --/home/worker/opt/zookeeper-3.4. 6/bin/. /conf//home/worker/opt/zookeeper-3.4. 6/bin/zkserver. SH {Start|start-foreground|stop|restart|status|upgrade|print-cmd}
3. Cluster configuration

Add the following configuration to each server host in the cluster

[Email protected] ~]# vim/etc/hosts192.168. 10.10   lfto-Zookeeper01192.168. 10.11   lfto-Zookeeper02192.168. 10.12   Lfto-zookeeper03

Modify the configuration file, configure the cluster

[[Email protected]Zookeeper01 conf]$ vim zoo.cfgserver.1=lfto-zookeeper01:2888:3888server.2=lfto-zookeeper02:2888:3888server.3=LFTO-ZOOKEEPER03:2888:3888[[Email protected]-zookeeper01 conf]$Echo '1'>>/home/worker/opt/zookeeper_data/myID .... [[Email protected]-zookeeper02 conf]$Echo '2'>>/home/worker/opt/zookeeper_data/Myid[[email protected]-zookeeper03 conf]$Echo '3'>>/home/worker/opt/zookeeper_data/myid

Restart Zookeeper Service

[Email protected] conf]$ ~/opt/zookeeper-3.4. 6/bin/zkserver. SH restart

  

Linux system Transport Koriyuki zookeeper cluster configuration

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.