Get the App
SLTechnology News&Howtos  ›  Servers  › 

II. Characteristics and data structure of Zookeeper cluster

Shulou Source: shulou.com Published: 2022-06-02 17:07:31 09月22日 Update

Zookeeper cluster features:

Zookeeper cluster features:

1. The host of zookeeper is called leader, and the slave is called follwer (one leader, multiple followers).

2. Without all the servers in the zookeeper cluster working, and more than half of the servers survive, zk can run normally (therefore, it is recommended that the number of zk clusters be odd)

3. The data stored by all nodes in zk are all the same.

4. Update requests are carried out in order. Requests from the same client are executed at once according to the order in which they are sent.

The following are the servers of the zookeeper cluster

Server1 server2 server3

There are two pieces of write data (instead of 1Magazine 2) when entering the server1,server1, write 1 first, then write 2. Because his data is globally consistent, every server in the zookeeper cluster has to write these two pieces of data. However, due to network reasons, when the data reaches server3, data 2 arrives first, and data 1 arrives later, but it is still possible to write data 1 first, then data 2, always in the original order, and will not change.

5. the atomicity of data update, one data either succeeds or fails.

Understand:

That is, when client sends a data to the zk cluster, all the machines in the cluster will execute, either successfully or failed. When the returned result is successful, it means that all the server in the cluster has been updated.

6. Real-time access to data in zk

Data structure of Zookeeper:

The data structure model of Zookeeper is similar to that of linux file system. As a whole, it can be regarded as a tree, each node becomes a znode, each znode can store 1MB data, and each znode can be uniquely identified by its path.

The difference with the linux file system is that the file system of zookeeper has no difference between files and directories. Each znode can not only have child nodes, but also store data. Only when files can be saved in a directory on linux can files be saved.

Znode is the node under "/", and each node under znode is identified by a unique path.

Tags: Data cluster file node either success time server system sequence update service data structure feature structure consistency that is identity directory path Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Huawei Linux Xiaomi