public class HS2ActivePassiveHARegistry extends ZkRegistryBase<HiveServer2Instance> implements ServiceRegistry<HiveServer2Instance>, HiveServer2HAInstanceSet
conf, doCheckAcls, encoder, hostname, UNIQUE_ID, UNIQUE_IDENTIFIER, USER_SCOPE_PATH_PREFIX, WORKER_GROUP, WORKER_PREFIX, workersPath, zooKeeperClient| Modifier and Type | Method and Description |
|---|---|
protected HiveServer2Instance |
createServiceInstance(org.apache.hadoop.registry.client.types.ServiceRecord srv) |
void |
failover() |
Collection<HiveServer2Instance> |
getAll()
Get an instance mapping which map worker identity to each instance.
|
org.apache.hadoop.yarn.api.records.ApplicationId |
getApplicationId() |
Set<HiveServer2Instance> |
getByHost(String host)
Get a list of service instances for a given host.
|
HiveServer2Instance |
getInstance(String instanceId)
Get an instance by worker identity.
|
ServiceInstanceSet<HiveServer2Instance> |
getInstances(String component,
long clusterReadyTimeoutMs)
Client API to get the list of instances registered via the current registry key.
|
HiveServer2Instance |
getLeader()
In Active/Passive setup, returns current active leader.
|
protected String |
getZkPathUser(org.apache.hadoop.conf.Configuration conf) |
String |
register()
Register the current instance - the implementation takes care of the endpoints to register.
|
void |
registerStateChangeListener(ServiceInstanceStateChangeListener<HiveServer2Instance> listener)
Adds state change listeners for service instances.
|
int |
size()
Get number of instances in the currently available.
|
void |
start()
Start the service registry
|
void |
stop()
Stop the service registry
|
void |
unregister()
Remove the current registration cleanly (implementation defined cleanup)
|
protected void |
unregisterInternal() |
ensureInstancesCache, getAllInternal, getByHostInternal, getInstanceByPath, getRegistrationZnodePath, getRootNamespace, getWorkerData, populateCache, registerServiceRecord, registerServiceRecord, sizeInternal, updateServiceRecordpublic void start()
throws IOException
ServiceRegistrystart in interface ServiceRegistry<HiveServer2Instance>start in class ZkRegistryBase<HiveServer2Instance>IOExceptionprotected void unregisterInternal()
unregisterInternal in class ZkRegistryBase<HiveServer2Instance>public String register() throws IOException
ServiceRegistryregister in interface ServiceRegistry<HiveServer2Instance>IOExceptionpublic void unregister()
ServiceRegistryunregister in interface ServiceRegistry<HiveServer2Instance>public ServiceInstanceSet<HiveServer2Instance> getInstances(String component, long clusterReadyTimeoutMs) throws IOException
ServiceRegistrygetInstances in interface ServiceRegistry<HiveServer2Instance>clusterReadyTimeoutMs - The time to wait for the cluster to be ready, if it's not
started yet. 0 means do not wait.IOExceptionpublic void stop()
ServiceRegistrystop in interface ServiceRegistry<HiveServer2Instance>stop in class ZkRegistryBase<HiveServer2Instance>protected HiveServer2Instance createServiceInstance(org.apache.hadoop.registry.client.types.ServiceRecord srv) throws IOException
createServiceInstance in class ZkRegistryBase<HiveServer2Instance>IOExceptionpublic void registerStateChangeListener(ServiceInstanceStateChangeListener<HiveServer2Instance> listener) throws IOException
ServiceRegistryregisterStateChangeListener in interface ServiceRegistry<HiveServer2Instance>registerStateChangeListener in class ZkRegistryBase<HiveServer2Instance>listener - - state change listenerIOExceptionpublic org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
throws IOException
getApplicationId in interface ServiceRegistry<HiveServer2Instance>IOExceptionprotected String getZkPathUser(org.apache.hadoop.conf.Configuration conf)
getZkPathUser in class ZkRegistryBase<HiveServer2Instance>public HiveServer2Instance getLeader()
HiveServer2HAInstanceSetgetLeader in interface HiveServer2HAInstanceSetpublic Collection<HiveServer2Instance> getAll()
ServiceInstanceSetgetAll in interface ServiceInstanceSet<HiveServer2Instance>public HiveServer2Instance getInstance(String instanceId)
ServiceInstanceSetgetInstance in interface ServiceInstanceSet<HiveServer2Instance>instanceId - worker idpublic Set<HiveServer2Instance> getByHost(String host)
ServiceInstanceSetgetByHost in interface ServiceInstanceSet<HiveServer2Instance>host - hostnamepublic int size()
ServiceInstanceSetsize in interface ServiceInstanceSet<HiveServer2Instance>Copyright © 2019 The Apache Software Foundation. All Rights Reserved.