@InterfaceStability.Evolving public class MicroZookeeperService extends org.apache.hadoop.service.AbstractService implements RegistryBindingSource, RegistryConstants, ZookeeperConfigOptions, MicroZookeeperServiceKeys
It implements RegistryBindingSource
and provides binding information,
once started. Until AbstractService.start()
is called, the hostname and
port may be undefined. Accordingly, the service raises an exception in this
condition.
If you wish to chain together a registry service with this one under
the same CompositeService
, this service must be added
as a child first.
It also sets the configuration parameter
RegistryConstants.KEY_REGISTRY_ZK_QUORUM
to its connection string. Any code with access to the service configuration
can view it.
DEFAULT_DNS_ENABLED, DEFAULT_DNS_PORT, DEFAULT_DNS_SPLIT_REVERSE_ZONE, DEFAULT_DNSSEC_PRIVATE_KEY_FILE, DEFAULT_REGISTRY_CLIENT_JAAS_CONTEXT, DEFAULT_REGISTRY_SECURE, DEFAULT_REGISTRY_SYSTEM_ACCOUNTS, DEFAULT_REGISTRY_USER_ACCOUNTS, DEFAULT_REGISTRY_ZK_QUORUM, DEFAULT_ZK_CONNECTION_TIMEOUT, DEFAULT_ZK_REGISTRY_ROOT, DEFAULT_ZK_RETRY_CEILING, DEFAULT_ZK_RETRY_INTERVAL, DEFAULT_ZK_RETRY_TIMES, DEFAULT_ZK_SESSION_TIMEOUT, DNS_PREFIX, KEY_DNS_BIND_ADDRESS, KEY_DNS_DOMAIN, KEY_DNS_ENABLED, KEY_DNS_PORT, KEY_DNS_SPLIT_REVERSE_ZONE, KEY_DNS_SPLIT_REVERSE_ZONE_RANGE, KEY_DNS_TTL, KEY_DNS_ZONE_IP_MAX, KEY_DNS_ZONE_IP_MIN, KEY_DNS_ZONE_MASK, KEY_DNS_ZONE_SUBNET, KEY_DNS_ZONES_DIR, KEY_DNSSEC_ENABLED, KEY_DNSSEC_PRIVATE_KEY_FILE, KEY_DNSSEC_PUBLIC_KEY, KEY_REGISTRY_CLIENT_AUTH, KEY_REGISTRY_CLIENT_AUTHENTICATION_ID, KEY_REGISTRY_CLIENT_AUTHENTICATION_PASSWORD, KEY_REGISTRY_CLIENT_JAAS_CONTEXT, KEY_REGISTRY_KERBEROS_REALM, KEY_REGISTRY_SECURE, KEY_REGISTRY_SYSTEM_ACCOUNTS, KEY_REGISTRY_USER_ACCOUNTS, KEY_REGISTRY_ZK_CONNECTION_TIMEOUT, KEY_REGISTRY_ZK_QUORUM, KEY_REGISTRY_ZK_RETRY_CEILING, KEY_REGISTRY_ZK_RETRY_INTERVAL, KEY_REGISTRY_ZK_RETRY_TIMES, KEY_REGISTRY_ZK_ROOT, KEY_REGISTRY_ZK_SESSION_TIMEOUT, MAX_FQDN_LABEL_LENGTH, PATH_SYSTEM_SERVICES, PATH_USER_SERVICES, PATH_USERS, REGISTRY_CLIENT_AUTH_ANONYMOUS, REGISTRY_CLIENT_AUTH_DIGEST, REGISTRY_CLIENT_AUTH_KERBEROS, REGISTRY_CLIENT_AUTH_SIMPLE, REGISTRY_PREFIX, SUBPATH_COMPONENTS, ZK_PREFIX
DEFAULT_ZK_ENABLE_SASL_CLIENT, PROP_ZK_ALLOW_FAILED_SASL_CLIENTS, PROP_ZK_ENABLE_SASL_CLIENT, PROP_ZK_KINIT_PATH, PROP_ZK_SASL_CLIENT_CONTEXT, PROP_ZK_SASL_CLIENT_USERNAME, PROP_ZK_SERVER_MAINTAIN_CONNECTION_DESPITE_SASL_FAILURE, PROP_ZK_SERVER_REALM, PROP_ZK_SERVER_SASL_CONTEXT, SCHEME_DIGEST, SCHEME_SASL
DEFAULT_ZKSERVICE_HOST, KEY_REGISTRY_ZKSERVICE_JAAS_CONTEXT, KEY_ZKSERVICE_ALLOW_FAILED_SASL_CLIENTS, KEY_ZKSERVICE_DIR, KEY_ZKSERVICE_HOST, KEY_ZKSERVICE_PORT, KEY_ZKSERVICE_TICK_TIME, ZKSERVICE_PREFIX
Constructor and Description |
---|
MicroZookeeperService(String name)
Create an instance
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDiagnostics(String text,
Object... args)
Append a formatted string to the diagnostics.
|
InetSocketAddress |
getConnectionAddress()
Get the connection address
|
String |
getConnectionString()
Get the connection string.
|
String |
getDiagnostics()
Get the diagnostics info
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf)
Initialize the service, including choosing a path for the data
|
protected void |
serviceStart()
Startup: start ZK.
|
protected void |
serviceStop()
When the service is stopped, it deletes the data directory
and its contents
|
boolean |
setupSecurity()
set up security.
|
BindingInformation |
supplyBindingInformation()
Supply the binding information for this registry
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
public MicroZookeeperService(String name)
name
- service namepublic String getConnectionString()
IllegalStateException
- if the connection is not yet validpublic InetSocketAddress getConnectionAddress()
IllegalStateException
- if the connection is not yet validprotected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
serviceInit
in class org.apache.hadoop.service.AbstractService
conf
- configurationException
protected void addDiagnostics(String text, Object... args)
A newline is appended afterwards.
text
- text including any format commandsargs
- arguments for the forma operation.public String getDiagnostics()
public boolean setupSecurity() throws IOException
IOException
protected void serviceStart() throws Exception
serviceStart
in class org.apache.hadoop.service.AbstractService
Exception
protected void serviceStop() throws Exception
serviceStop
in class org.apache.hadoop.service.AbstractService
Exception
public BindingInformation supplyBindingInformation()
RegistryBindingSource
supplyBindingInformation
in interface RegistryBindingSource
Copyright © 2008–2019 Apache Software Foundation. All rights reserved.