public class ZooKeeperUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ZooKeeperUtils.SecureAclProvider
Secure
ACLProvider implementation. |
static class |
ZooKeeperUtils.ZkClientACLMode
ZooKeeper client ACL mode enum.
|
Modifier and Type | Field and Description |
---|---|
static String |
HA_STORAGE_COMPLETED_CHECKPOINT
The prefix of the completed checkpoint file.
|
static String |
HA_STORAGE_SUBMITTED_JOBGRAPH_PREFIX
The prefix of the submitted job graph file.
|
Modifier and Type | Method and Description |
---|---|
static ZooKeeperCheckpointIDCounter |
createCheckpointIDCounter(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
JobID jobId)
Creates a
ZooKeeperCheckpointIDCounter instance. |
static CompletedCheckpointStore |
createCompletedCheckpoints(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
JobID jobId,
int maxNumberOfCheckpointsToRetain,
Executor executor)
Creates a
DefaultCompletedCheckpointStore instance with ZooKeeperStateHandleStore . |
static <T extends Serializable> |
createFileSystemStateStorage(Configuration configuration,
String prefix)
Creates a
FileSystemStateStorageHelper instance. |
static JobGraphStore |
createJobGraphs(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration)
Creates a
DefaultJobGraphStore instance with ZooKeeperStateHandleStore ,
ZooKeeperJobGraphStoreWatcher and ZooKeeperJobGraphStoreUtil . |
static ZooKeeperLeaderElectionDriverFactory |
createLeaderElectionDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration)
Creates a
LeaderElectionDriverFactory implemented by ZooKeeper. |
static ZooKeeperLeaderElectionDriverFactory |
createLeaderElectionDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
String pathSuffix)
Creates a
LeaderElectionDriverFactory implemented by ZooKeeper. |
static DefaultLeaderElectionService |
createLeaderElectionService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration)
Creates a
DefaultLeaderElectionService instance with ZooKeeperLeaderElectionDriver . |
static DefaultLeaderElectionService |
createLeaderElectionService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
String pathSuffix)
Creates a
DefaultLeaderElectionService instance with ZooKeeperLeaderElectionDriver . |
static ZooKeeperLeaderRetrievalDriverFactory |
createLeaderRetrievalDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration)
Creates a
LeaderRetrievalDriverFactory implemented by ZooKeeper. |
static ZooKeeperLeaderRetrievalDriverFactory |
createLeaderRetrievalDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
String pathSuffix)
Creates a
LeaderRetrievalDriverFactory implemented by ZooKeeper. |
static DefaultLeaderRetrievalService |
createLeaderRetrievalService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration)
Creates a
DefaultLeaderRetrievalService instance with ZooKeeperLeaderRetrievalDriver . |
static DefaultLeaderRetrievalService |
createLeaderRetrievalService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
Configuration configuration,
String pathSuffix)
Creates a
DefaultLeaderRetrievalService instance with ZooKeeperLeaderRetrievalDriver . |
static <T extends Serializable> |
createZooKeeperStateHandleStore(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
String path,
RetrievableStateStorageHelper<T> stateStorage)
Creates an instance of
ZooKeeperStateHandleStore . |
static String |
generateZookeeperPath(String root,
String namespace) |
static String |
getPathForJob(JobID jobId)
Returns the JobID as a String (with leading slash).
|
static String |
getZooKeeperEnsemble(Configuration flinkConf)
Returns the configured ZooKeeper quorum (and removes whitespace, because ZooKeeper does not
tolerate it).
|
static boolean |
isZooKeeperRecoveryMode(Configuration flinkConf)
Returns whether
HighAvailabilityMode.ZOOKEEPER is configured. |
static org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework |
startCuratorFramework(Configuration configuration)
Starts a
CuratorFramework instance and connects it to the given ZooKeeper quorum. |
static org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework |
useNamespaceAndEnsurePath(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
String path)
Returns a facade of the client that uses the specified namespace, and ensures that all nodes
in the path exist.
|
public static final String HA_STORAGE_SUBMITTED_JOBGRAPH_PREFIX
public static final String HA_STORAGE_COMPLETED_CHECKPOINT
public static org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework startCuratorFramework(Configuration configuration)
CuratorFramework
instance and connects it to the given ZooKeeper quorum.configuration
- Configuration
object containing the configuration valuesCuratorFramework
instancepublic static boolean isZooKeeperRecoveryMode(Configuration flinkConf)
HighAvailabilityMode.ZOOKEEPER
is configured.public static String getZooKeeperEnsemble(Configuration flinkConf) throws IllegalConfigurationException
IllegalConfigurationException
public static DefaultLeaderRetrievalService createLeaderRetrievalService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration)
DefaultLeaderRetrievalService
instance with ZooKeeperLeaderRetrievalDriver
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuesDefaultLeaderRetrievalService
instance.public static DefaultLeaderRetrievalService createLeaderRetrievalService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, String pathSuffix)
DefaultLeaderRetrievalService
instance with ZooKeeperLeaderRetrievalDriver
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuespathSuffix
- The path suffix which we want to appendDefaultLeaderRetrievalService
instance.public static ZooKeeperLeaderRetrievalDriverFactory createLeaderRetrievalDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration)
LeaderRetrievalDriverFactory
implemented by ZooKeeper.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuesLeaderRetrievalDriverFactory
instance.public static ZooKeeperLeaderRetrievalDriverFactory createLeaderRetrievalDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, String pathSuffix)
LeaderRetrievalDriverFactory
implemented by ZooKeeper.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuespathSuffix
- The path suffix which we want to appendLeaderRetrievalDriverFactory
instance.public static DefaultLeaderElectionService createLeaderElectionService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration)
DefaultLeaderElectionService
instance with ZooKeeperLeaderElectionDriver
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuesDefaultLeaderElectionService
instance.public static DefaultLeaderElectionService createLeaderElectionService(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, String pathSuffix)
DefaultLeaderElectionService
instance with ZooKeeperLeaderElectionDriver
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuespathSuffix
- The path suffix which we want to appendDefaultLeaderElectionService
instance.public static ZooKeeperLeaderElectionDriverFactory createLeaderElectionDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration)
LeaderElectionDriverFactory
implemented by ZooKeeper.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuesLeaderElectionDriverFactory
instance.public static ZooKeeperLeaderElectionDriverFactory createLeaderElectionDriverFactory(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, String pathSuffix)
LeaderElectionDriverFactory
implemented by ZooKeeper.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
object containing the configuration valuespathSuffix
- The path suffix which we want to appendLeaderElectionDriverFactory
instance.public static JobGraphStore createJobGraphs(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration) throws Exception
DefaultJobGraphStore
instance with ZooKeeperStateHandleStore
,
ZooKeeperJobGraphStoreWatcher
and ZooKeeperJobGraphStoreUtil
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
objectDefaultJobGraphStore
instanceException
- if the submitted job graph store cannot be createdpublic static CompletedCheckpointStore createCompletedCheckpoints(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, JobID jobId, int maxNumberOfCheckpointsToRetain, Executor executor) throws Exception
DefaultCompletedCheckpointStore
instance with ZooKeeperStateHandleStore
.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
objectjobId
- ID of job to create the instance formaxNumberOfCheckpointsToRetain
- The maximum number of checkpoints to retainexecutor
- to run ZooKeeper callbacksDefaultCompletedCheckpointStore
instanceException
- if the completed checkpoint store cannot be createdpublic static String getPathForJob(JobID jobId)
public static <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, String path, RetrievableStateStorageHelper<T> stateStorage) throws Exception
ZooKeeperStateHandleStore
.T
- Type of stateclient
- ZK clientpath
- Path to use for the client namespacestateStorage
- RetrievableStateStorageHelper that persist the actual state and whose
returned state handle is then written to ZooKeeperZooKeeperStateHandleStore
instanceException
- ZK errorspublic static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, Configuration configuration, JobID jobId)
ZooKeeperCheckpointIDCounter
instance.client
- The CuratorFramework
ZooKeeper client to useconfiguration
- Configuration
objectjobId
- ID of job to create the instance forZooKeeperCheckpointIDCounter
instancepublic static <T extends Serializable> FileSystemStateStorageHelper<T> createFileSystemStateStorage(Configuration configuration, String prefix) throws IOException
FileSystemStateStorageHelper
instance.T
- Type of the state objectsconfiguration
- Configuration
objectprefix
- Prefix for the created filesFileSystemStateStorageHelper
instanceIOException
- if file system state storage cannot be createdpublic static org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework useNamespaceAndEnsurePath(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, String path) throws Exception
client
- ZK clientpath
- the new namespaceException
- ZK errorsCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.