Introduction to zookeeper

As the cornerstone of opening a distributed architecture, there must be other options besides   

Some of my own understanding, if there is a mistake, please be sure to correct it!

1. What is it?

A solution for distributed data consistency.

2. What is the use

Data publishing /subscription (configuration center)   , load balancing ( dubbo uses the zookeeper mechanism to achieve load balancing) , naming service,

Master election (kafka, hadoop, hbase), distributed queue, distributed lock.

Introduction to zookeeper

1. CAP theory and BASE theory

References: http://www.jdon.com/bigdata/how-to-understand-cap.html 

 CAP theory of distributed systems: The theory first summarizes three characteristics of distributed systems as follows:
● Consistency (C): Whether all data backups in distributed systems have the same value at the same time. (equivalent to all nodes accessing the same latest copy of data)
● Availability (A): After some nodes in the cluster fail, the cluster as a whole can still respond to the client's read and write requests. (High availability for data updates)
● Partition fault tolerance (P): In practical terms, partition is equivalent to the time limit for communication. If the system cannot achieve data consistency within the time limit, it means that a partition has occurred, and a choice must be made between C and A for the current operation.
Understanding of CA conflict: C requires backup before returning to ensure data consistency (failure if there is a failure), while A does not consider the situation of data synchronization, which will lead to dirty data in the data
The base theory is to upgrade the cap theory, ba means basically available, s means soft-state, which means that   in a system based on the client-server mode, the server side has a state, that is, you can know the synchronization status of the current node. e means is eventual consistency (eventual synchronization)
2. Zookeeper's data model
Tree structure znode (node), can be monitored, and the name is unique at the same level
Node types are divided into:
 PERSISTENT (persistent node, service disconnection still exists)
PERSISTENT_SEQUENTIAL (for example: persistent sequence/test0000000019 is an ordered persistent node)
EPHEMERAL (temporary node, service disconnection, node disappears)
EPHEMERAL_SEQUENTIAL (temporary ordered node)
3.zookeeper features
3.1 Sequential consistency,

Transaction requests (additions, deletions, and modifications) initiated from the same client will eventually be applied to zookeeper in strict order (queue, fifo)

3,2 atomicity

The application of the processing results of all transaction requests on all machines in the entire cluster is consistent, that is, either all machines in the entire cluster have successfully applied a certain transaction,

or don't apply at all

3.3 Be more reliable

Once the server successfully applies a transaction data and responds to the client, the data must be synchronized and preserved throughout the cluster

3.4 Real-time

Once a transaction is successfully applied, the client can immediately read the latest data status after the transaction has been changed from the server; ( zookeeper only guarantees near real-time within a certain period of time)

 

 
 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325110629&siteId=291194637