Use Zookeeper to implement leader election-Leader Latch

All nodes participating in the election will create a sequential node. The smallest node will be set as the master node. The nodes that have not grabbed the leader will listen to the delete event of the previous node. After the previous node is deleted, the master will be regained. After the node manually calls the close() method or the master node hangs up, subsequent child nodes will preempt the master.

Spark uses this method

 

Guess you like

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