Zookeeper data synchronization process

In the first lesson, we learned about the composition of zk clusters. Zookeeper uses three different cluster roles to form the entire high-performance cluster.

In zookeeper, the client will randomly connect to a node in the zookeeper cluster. If it is a read request, it will directly read the data from the current node. If it is a write request, the request will be forwarded to the leader to submit the transaction, and then the leader will Broadcast transaction, as long as more than half of the nodes write successfully, the write request will be submitted (class 2PC transaction)

Then the problem is coming

1. How to elect the leader node in the cluster? 

2. After the leader node crashes, the entire cluster cannot process write requests. How to quickly elect a new leader from other nodes?

3. How to ensure data consistency between the leader node and each follower node

 

Guess you like

Origin blog.csdn.net/Leon_Jinhai_Sun/article/details/112853580