Source code analysis of leader election-QuorumPeer.start

The QuorumPeer.start method overrides the start of Thread. That is, before the thread starts, it will do the following

1. Restore snapshot data through loadDataBase

2. cnxnFactory.start() starts zkServer, which is equivalent to that the user can communicate through port 2181, which will be discussed later. We still use leader election as the main line

@Override 
public synchronized void start() { 
	loadDataBase(); 
	cnxnFactory.start(); 
	startLeaderElection(); 
	super.start(); 
}

 

Guess you like

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