Class ZookeeperClient
java.lang.Object
org.apache.hadoop.security.authentication.util.ZookeeperClient
Utility class to create a CuratorFramework object that can be used to connect to Zookeeper
based on configuration values that can be supplied from different configuration properties.
It is used from ZKDelegationTokenSecretManager in hadoop-common, and from
ZKSignerSecretProvider.
The class implements a fluid API to set up all the different properties. A very basic setup
would seem like:
ZookeeperClient.configure()
.withConnectionString(<connectionString>)
.create();
Mandatory parameters to be set:
- connectionString: A Zookeeper connection string.
- if authentication type is set to 'sasl':
- keytab: the location of the keytab to be used for Kerberos authentication
- principal: the Kerberos principal to be used from the supplied Kerberos keytab file.
- jaasLoginEntryName: the login entry name in the JAAS configuration that is created for the KerberosLoginModule to be used by the Zookeeper client code.
- if SSL is enabled:
- the location of the Truststore file to be used
- the location of the Keystore file to be used
- if the Truststore is protected by a password, then the password of the Truststore
- if the Keystore is protected by a password, then the password if the Keystore
- authentication type: 'none'
- sessionTimeout: either the system property curator-default-session-timeout, or 60 seconds
- connectionTimeout: either the system property curator-default-connection-timeout, or 15 seconds
- retryPolicy: an ExponentialBackoffRetry, with a starting interval of 1 seconds and 3 retries
- zkFactory: a ConfigurableZookeeperFactory instance, to allow SSL setup via ZKClientConfig
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ZookeeperClientorg.apache.curator.framework.CuratorFrameworkcreate()enableSSL(boolean enable) withAuthType(String authType) withConnectionString(String conn) withConnectionTimeout(int timeoutMS) withJaasLoginEntryName(String entryName) withKeystore(String keystorePath) withKeystorePassword(String keystorePass) withKeytab(String keytabPath) withNamespace(String ns) withPrincipal(String princ) withRetryPolicy(org.apache.curator.RetryPolicy policy) withSessionTimeout(int timeoutMS) withTruststore(String truststorePath) withTruststorePassword(String truststorePass) withZookeeperFactory(org.apache.curator.utils.ZookeeperFactory factory)
-
Constructor Details
-
ZookeeperClient
public ZookeeperClient()
-
-
Method Details
-
configure
-
withConnectionString
-
withNamespace
-
withAuthType
-
withKeytab
-
withPrincipal
-
withJaasLoginEntryName
-
withSessionTimeout
-
withConnectionTimeout
-
withRetryPolicy
-
withZookeeperFactory
-
enableSSL
-
withKeystore
-
withKeystorePassword
-
withTruststore
-
withTruststorePassword
-
create
public org.apache.curator.framework.CuratorFramework create()
-