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, updateServiceRecord
public void start() throws IOException
ServiceRegistry
start
in interface ServiceRegistry<HiveServer2Instance>
start
in class ZkRegistryBase<HiveServer2Instance>
IOException
protected void unregisterInternal()
unregisterInternal
in class ZkRegistryBase<HiveServer2Instance>
public String register() throws IOException
ServiceRegistry
register
in interface ServiceRegistry<HiveServer2Instance>
IOException
public void unregister()
ServiceRegistry
unregister
in interface ServiceRegistry<HiveServer2Instance>
public ServiceInstanceSet<HiveServer2Instance> getInstances(String component, long clusterReadyTimeoutMs) throws IOException
ServiceRegistry
getInstances
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.IOException
public void stop()
ServiceRegistry
stop
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>
IOException
public void registerStateChangeListener(ServiceInstanceStateChangeListener<HiveServer2Instance> listener) throws IOException
ServiceRegistry
registerStateChangeListener
in interface ServiceRegistry<HiveServer2Instance>
registerStateChangeListener
in class ZkRegistryBase<HiveServer2Instance>
listener
- - state change listenerIOException
public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId() throws IOException
getApplicationId
in interface ServiceRegistry<HiveServer2Instance>
IOException
protected String getZkPathUser(org.apache.hadoop.conf.Configuration conf)
getZkPathUser
in class ZkRegistryBase<HiveServer2Instance>
public HiveServer2Instance getLeader()
HiveServer2HAInstanceSet
getLeader
in interface HiveServer2HAInstanceSet
public Collection<HiveServer2Instance> getAll()
ServiceInstanceSet
getAll
in interface ServiceInstanceSet<HiveServer2Instance>
public HiveServer2Instance getInstance(String instanceId)
ServiceInstanceSet
getInstance
in interface ServiceInstanceSet<HiveServer2Instance>
instanceId
- worker idpublic Set<HiveServer2Instance> getByHost(String host)
ServiceInstanceSet
getByHost
in interface ServiceInstanceSet<HiveServer2Instance>
host
- hostnamepublic int size()
ServiceInstanceSet
size
in interface ServiceInstanceSet<HiveServer2Instance>
Copyright © 2022 The Apache Software Foundation. All rights reserved.