flink LeaderElectionService需要处理哪种争用?

时间:2019-05-27 09:18:57

标签: apache-flink flink-streaming

Flink在LeaderElectionService.java中有以下评论

https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionService.java#L26

此类打算处理哪种争用?

 * Interface for a service which allows to elect a leader among 
   a group of contenders.
 * Prior to using this service, it has to be started calling 
   the start method. The start method
 * takes the contender as a parameter. If there are multiple 
   contenders, then each contender has
 * to instantiate its own leader election service.

1 个答案:

答案 0 :(得分:0)

从Flink 1.8开始,有两个类实现LeaderContender接口。 JobManagerRunnerWebMonitorEndpoint需要高可用性,并需要LeaderElectionService。

public class JobManagerRunner implements LeaderContender, 
                     OnCompletionActions, AutoCloseableAsync {...

public class WebMonitorEndpoint<T extends RestfulGateway> 
    extends RestServerEndpoint implements LeaderContender, JsonArchivist {...