Got it

HCIA-Big Data | Introduction to ZooKeeper

Latest reply: Apr 11, 2022 14:32:42 662 14 9 0 0

Hello, everyone!

In this post, I want to discuss with you the ZooKeeper.

ZooKeeper Overview

The ZooKeeper distributed service framework is used to solve some data management problems that are frequently encountered in distributed applications and provide distributed and highly available coordination service capabilities.

In insecurity mode, ZooKeeper depends on Kerberos and LdapServer for security authentication, but in non-security mode, ZooKeeper does not depend on them anymore. As a bottom-layer component, ZooKeeper is widely used and dependent on upper-layer components, such as Kafka, HDFS, HBase, and Storm.

ZooKeeper Service Architecture

Model

zooKeeper service

The ZooKeeper cluster consists of a group of server nodes. In this group, there is only one leader node, and

the other nodes are followers.

The leader is elected during the startup.

ZooKeeper uses the custom atomic message protocol to ensure data consistency among nodes in the entire system.

After receiving a data change request, the leader node writes the data to the disk and then to the memory.

DR Capability

If the ZooKeeper can complete the election, it can provide services for external systems.

  • During ZooKeeper election, if an instance obtains more than half of the votes, the instance becomes the leader.

For a service with n instances, n may be an odd or even number.

  • When n is an odd number, assume: n=2x+1; then the node needs to obtain x+1 votes to become the leader, and the DR capability is x.

  • When n is an even number, that: n=2x+2; then the node needs to obtain x+2 (more than half) votes to become the leader, and the DR capability is x.

Key Features of ZooKeeper

Eventual consistency: All servers are displayed in the same view.

Real-time capability: Clients can obtain server updates and failures within a specified period of time.

Reliability: A message will be received by all servers.

Wait-free: Slow or faulty clients cannot intervene the requests of rapid clients so that the requests of each client can be processed effectively.

Atomicity: Data update either succeeds or fails. There are no intermediate states.

Sequence consistency: Updates sent by the client are applied in the sequence in which they are sent.

Read Function of ZooKeeper

According to the consistency of ZooKeeper, the client obtains the same view regardless of the server connected to the client. Therefore, read operations can be performed between the client and any node.

Read Function of ZooKeeper


Write Function of ZooKeeper

As for the writing process just as the figure shows A client can initiate a written request on any server which is similar to the reading process. And the server will send the request to the leader, the node ZK2 is the leader. After receiving the written request the leader sends the request to followers and asks the followers whether the write operation can be performed.

The followers send back ACK messages based on their own condition. If the number of servers that write operations can be performed is greater than 50% of the total the write operation can be performed.

Then the leader performs the write operation and data is synchronized to the followers. Until now the write operation is complete.

Write Function of ZooKeeper

Commands for ZooKeeper Clients

To invoke a ZooKeeper client, run the following command: 

zkCli.sh –server 172.16.0.1:24002

To create a node: create /node

To list subnodes: ls /node

To create node data: set /node data

To obtain node data: get /node

To delete a node: delete /node

To delete a node and all its subnodes: deleteall /node

The ZooKeeper distributed service framework is used to solve some data management problems that are frequently encountered in distributed applications and provide distributed and highly available coordination service capabilities.

That's all, thanks!

The post is synchronized to: HCIA-Big Data

  • x
  • convention:

little_fish
Admin Created Mar 29, 2022 07:46:07

ZooKeeper
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Mar 30, 2022 01:03:05 (0) (0)
Thanks!  
NTan33
Created Mar 30, 2022 06:51:41

Something new to learn about every day.
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 1, 2022 00:52:57 (0) (0)
We study together.  
wissal
MVE Created Apr 11, 2022 07:43:58

Learn to learn, increase our knowledge
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 11, 2022 07:45:35 (0) (0)
 
zaheernew
MVE Author Created Apr 11, 2022 08:16:35

Useful Info
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 12, 2022 06:47:03 (0) (0)
Thanks!  
Zebra
Created Apr 11, 2022 10:07:52

Thanks for sharing
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 12, 2022 06:47:12 (0) (0)
 
thisu
Created Apr 11, 2022 10:10:28

Thanks for sharing
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 12, 2022 06:47:19 (0) (0)
 
TuanNg
Created Apr 11, 2022 14:32:42

Thanks for sharing
View more
  • x
  • convention:

olive.zhao
olive.zhao Created Apr 12, 2022 06:47:25 (0) (0)
 

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.
Information Protection Guide
Thanks for using Huawei Enterprise Support Community! We will help you learn how we collect, use, store and share your personal information and the rights you have in accordance with Privacy Policy and User Agreement.