Class ZooKeeperLeaderElectionHaServices
- java.lang.Object
-
- org.apache.flink.runtime.highavailability.AbstractHaServices
-
- org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperLeaderElectionHaServices
-
- All Implemented Interfaces:
AutoCloseable,GloballyCleanableResource,ClientHighAvailabilityServices,HighAvailabilityServices
public class ZooKeeperLeaderElectionHaServices extends AbstractHaServices
ZooKeeper HA services that only use a single leader election per process./flink +/cluster_id_1/leader/latch | | /resource_manager/connection_info | | /dispatcher/connection_info | | /rest_server/connection_info | | /job-id-1/connection_info | | /job-id-2/connection_info | | | | | +jobgraphs/job-id-1 | | /job-id-2 | +jobs/job-id-1/checkpoints/latest | | /latest-1 | | /latest-2 | | /checkpoint_id_counter
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.highavailability.AbstractHaServices
configuration, ioExecutor, logger
-
Fields inherited from interface org.apache.flink.runtime.highavailability.HighAvailabilityServices
DEFAULT_JOB_ID, DEFAULT_LEADER_ID
-
-
Constructor Summary
Constructors Constructor Description ZooKeeperLeaderElectionHaServices(CuratorFrameworkWithUnhandledErrorListener curatorFrameworkWrapper, org.apache.flink.configuration.Configuration configuration, Executor executor, BlobStoreService blobStoreService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CheckpointRecoveryFactorycreateCheckpointRecoveryFactory()Create the checkpoint recovery factory for the job manager.ExecutionPlanStorecreateExecutionPlanStore()Create the submitted execution plan store for the job manager.protected LeaderRetrievalServicecreateLeaderRetrievalService(String componentId)Create leader retrieval service with specified leaderName.protected voiddeleteZNode(String path)protected StringgetLeaderPathForDispatcher()Get the leader path for Dispatcher.protected StringgetLeaderPathForJobManager(org.apache.flink.api.common.JobID jobID)Get the leader path for specific JobManager.protected StringgetLeaderPathForResourceManager()Get the leader path for ResourceManager.protected StringgetLeaderPathForRestServer()Get the leader path for RestServer.protected voidinternalCleanup()Clean up the meta data in the distributed system(e.g.protected voidinternalCleanupJobData(org.apache.flink.api.common.JobID jobID)Clean up the meta data in the distributed system(e.g.protected voidinternalClose()Closes the components which is used for external operations(e.g.-
Methods inherited from class org.apache.flink.runtime.highavailability.AbstractHaServices
cleanupAllData, close, createBlobStore, getCheckpointRecoveryFactory, getClusterRestEndpointLeaderElection, getClusterRestEndpointLeaderRetriever, getDispatcherLeaderElection, getDispatcherLeaderRetriever, getExecutionPlanStore, getJobManagerLeaderElection, getJobManagerLeaderRetriever, getJobManagerLeaderRetriever, getJobResultStore, getResourceManagerLeaderElection, getResourceManagerLeaderRetriever, globalCleanupAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.highavailability.HighAvailabilityServices
closeWithOptionalClean, getWebMonitorLeaderElection, getWebMonitorLeaderRetriever
-
-
-
-
Constructor Detail
-
ZooKeeperLeaderElectionHaServices
public ZooKeeperLeaderElectionHaServices(CuratorFrameworkWithUnhandledErrorListener curatorFrameworkWrapper, org.apache.flink.configuration.Configuration configuration, Executor executor, BlobStoreService blobStoreService) throws Exception
- Throws:
Exception
-
-
Method Detail
-
createCheckpointRecoveryFactory
public CheckpointRecoveryFactory createCheckpointRecoveryFactory() throws Exception
Description copied from class:AbstractHaServicesCreate the checkpoint recovery factory for the job manager.- Specified by:
createCheckpointRecoveryFactoryin classAbstractHaServices- Returns:
- Checkpoint recovery factory
- Throws:
Exception
-
createExecutionPlanStore
public ExecutionPlanStore createExecutionPlanStore() throws Exception
Description copied from class:AbstractHaServicesCreate the submitted execution plan store for the job manager.- Specified by:
createExecutionPlanStorein classAbstractHaServices- Returns:
- Submitted execution plan store
- Throws:
Exception- if the submitted execution plan store could not be created
-
internalClose
protected void internalClose()
Description copied from class:AbstractHaServicesCloses the components which is used for external operations(e.g. Zookeeper Client, Kubernetes Client).- Specified by:
internalClosein classAbstractHaServices
-
internalCleanup
protected void internalCleanup() throws ExceptionDescription copied from class:AbstractHaServicesClean up the meta data in the distributed system(e.g. Zookeeper, Kubernetes ConfigMap).If an exception occurs during internal cleanup, we will continue the cleanup in
AbstractHaServices.cleanupAllData()and report exceptions only after all cleanup steps have been attempted.- Specified by:
internalCleanupin classAbstractHaServices- Throws:
Exception- when do the cleanup operation on external storage.
-
internalCleanupJobData
protected void internalCleanupJobData(org.apache.flink.api.common.JobID jobID) throws ExceptionDescription copied from class:AbstractHaServicesClean up the meta data in the distributed system(e.g. Zookeeper, Kubernetes ConfigMap) for the specified Job. Method implementations need to be thread-safe.- Specified by:
internalCleanupJobDatain classAbstractHaServices- Parameters:
jobID- The identifier of the job to cleanup.- Throws:
Exception- when do the cleanup operation on external storage.
-
createLeaderRetrievalService
protected LeaderRetrievalService createLeaderRetrievalService(String componentId)
Description copied from class:AbstractHaServicesCreate leader retrieval service with specified leaderName.- Specified by:
createLeaderRetrievalServicein classAbstractHaServices- Parameters:
componentId- ConfigMap name in Kubernetes or child node path in Zookeeper.- Returns:
- Return LeaderRetrievalService using Zookeeper or Kubernetes.
-
getLeaderPathForResourceManager
protected String getLeaderPathForResourceManager()
Description copied from class:AbstractHaServicesGet the leader path for ResourceManager.- Specified by:
getLeaderPathForResourceManagerin classAbstractHaServices- Returns:
- Return the ResourceManager leader name. It is ConfigMap name in Kubernetes or child node path in Zookeeper.
-
getLeaderPathForDispatcher
protected String getLeaderPathForDispatcher()
Description copied from class:AbstractHaServicesGet the leader path for Dispatcher.- Specified by:
getLeaderPathForDispatcherin classAbstractHaServices- Returns:
- Return the Dispatcher leader name. It is ConfigMap name in Kubernetes or child node path in Zookeeper.
-
getLeaderPathForJobManager
protected String getLeaderPathForJobManager(org.apache.flink.api.common.JobID jobID)
Description copied from class:AbstractHaServicesGet the leader path for specific JobManager.- Specified by:
getLeaderPathForJobManagerin classAbstractHaServices- Parameters:
jobID- job id- Returns:
- Return the JobManager leader name for specified job id. It is ConfigMap name in Kubernetes or child node path in Zookeeper.
-
getLeaderPathForRestServer
protected String getLeaderPathForRestServer()
Description copied from class:AbstractHaServicesGet the leader path for RestServer.- Specified by:
getLeaderPathForRestServerin classAbstractHaServices- Returns:
- Return the RestServer leader name. It is ConfigMap name in Kubernetes or child node path in Zookeeper.
-
-