public class RESTApiClusterManager extends org.apache.hadoop.conf.Configured implements ClusterManager
Modifier and Type | Class and Description |
---|---|
private static class |
RESTApiClusterManager.HealthSummary
Represents of the high-level health status of a subject in the cluster.
|
private static class |
RESTApiClusterManager.RoleCommand |
private static class |
RESTApiClusterManager.RoleState
Represents the configured run state of a role.
|
(package private) static class |
RESTApiClusterManager.Service |
ClusterManager.ServiceType
Modifier and Type | Field and Description |
---|---|
private static String |
API_VERSION |
private javax.ws.rs.client.Client |
client |
private String |
clusterName |
private static String |
DEFAULT_CLUSTER_NAME |
private static String |
DEFAULT_SERVER_HOSTNAME |
private static String |
DEFAULT_SERVER_PASSWORD |
private static String |
DEFAULT_SERVER_USERNAME |
private ClusterManager |
hBaseClusterManager |
private static org.slf4j.Logger |
LOG |
private static org.apache.hbase.thirdparty.com.google.gson.JsonParser |
parser |
private static String |
REST_API_CLUSTER_MANAGER_CLUSTER_NAME |
private static String |
REST_API_CLUSTER_MANAGER_HOSTNAME |
private static String |
REST_API_CLUSTER_MANAGER_PASSWORD |
private static String |
REST_API_CLUSTER_MANAGER_USERNAME |
private static String |
REST_API_DELEGATE_CLUSTER_MANAGER |
private org.apache.hadoop.hbase.util.RetryCounterFactory |
retryCounterFactory |
private static Map<ClusterManager.ServiceType,RESTApiClusterManager.Service> |
roleServiceType |
private String |
serverHostname |
Constructor and Description |
---|
RESTApiClusterManager() |
Modifier and Type | Method and Description |
---|---|
private static Map<ClusterManager.ServiceType,RESTApiClusterManager.Service> |
buildRoleServiceTypeMap() |
private long |
doRoleCommand(String serviceName,
String roleName,
RESTApiClusterManager.RoleCommand roleCommand)
Issues a command (e.g.
|
private <T> T |
executeWithRetries(Callable<T> callable)
Helper method for executing retryable work.
|
private Optional<org.apache.hbase.thirdparty.com.google.gson.JsonObject> |
getCommand(long commandId) |
private String |
getFromURIGet(URI uri) |
private RESTApiClusterManager.HealthSummary |
getHealthSummary(String serviceName,
String roleType,
String hostId) |
private String |
getHostId(String hostname) |
private String |
getRoleName(String serviceName,
String roleType,
String hostId) |
private String |
getRolePropertyValue(String serviceName,
String roleType,
String hostId,
String property) |
private RESTApiClusterManager.RoleState |
getRoleState(ClusterManager.ServiceType service,
String hostname) |
private RESTApiClusterManager.RoleState |
getRoleState(String serviceName,
String roleType,
String hostId) |
private String |
getServiceName(RESTApiClusterManager.Service service) |
private boolean |
hasCommandCompleted(long commandId)
Return
true if the commandId has finished processing. |
private boolean |
hasCommandCompletedSuccessfully(long commandId)
Return
true if the commandId has finished successfully. |
boolean |
isRunning(ClusterManager.ServiceType service,
String hostname,
int port)
Returns whether the service is running on the remote host.
|
void |
kill(ClusterManager.ServiceType service,
String hostname,
int port)
Kills the service running on the given host
|
private void |
performClusterManagerCommand(ClusterManager.ServiceType role,
String hostname,
RESTApiClusterManager.RoleCommand command) |
void |
restart(ClusterManager.ServiceType service,
String hostname,
int port)
Restart the service on the given host
|
void |
resume(ClusterManager.ServiceType service,
String hostname,
int port)
Resumes the services running on the given host
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
start(ClusterManager.ServiceType service,
String hostname,
int port)
Start the service on the given host
|
void |
stop(ClusterManager.ServiceType service,
String hostname,
int port)
Stop the service on the given host
|
void |
suspend(ClusterManager.ServiceType service,
String hostname,
int port)
Suspends the service running on the given host
|
private void |
waitFor(Callable<Boolean> predicate) |
private static final String REST_API_CLUSTER_MANAGER_HOSTNAME
private static final String REST_API_CLUSTER_MANAGER_USERNAME
private static final String REST_API_CLUSTER_MANAGER_PASSWORD
private static final String REST_API_CLUSTER_MANAGER_CLUSTER_NAME
private static final String REST_API_DELEGATE_CLUSTER_MANAGER
private static final org.apache.hbase.thirdparty.com.google.gson.JsonParser parser
private static final String DEFAULT_SERVER_HOSTNAME
private static final String DEFAULT_SERVER_USERNAME
private static final String DEFAULT_SERVER_PASSWORD
private static final String DEFAULT_CLUSTER_NAME
private String serverHostname
private String clusterName
private static final String API_VERSION
private final javax.ws.rs.client.Client client
private ClusterManager hBaseClusterManager
private org.apache.hadoop.hbase.util.RetryCounterFactory retryCounterFactory
private static final org.slf4j.Logger LOG
private static final Map<ClusterManager.ServiceType,RESTApiClusterManager.Service> roleServiceType
RESTApiClusterManager()
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
setConf
in class org.apache.hadoop.conf.Configured
public void start(ClusterManager.ServiceType service, String hostname, int port)
ClusterManager
start
in interface ClusterManager
public void stop(ClusterManager.ServiceType service, String hostname, int port)
ClusterManager
stop
in interface ClusterManager
public void restart(ClusterManager.ServiceType service, String hostname, int port)
ClusterManager
restart
in interface ClusterManager
public boolean isRunning(ClusterManager.ServiceType service, String hostname, int port)
ClusterManager
isRunning
in interface ClusterManager
public void kill(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
kill
in interface ClusterManager
IOException
public void suspend(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
suspend
in interface ClusterManager
IOException
public void resume(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
resume
in interface ClusterManager
IOException
private void performClusterManagerCommand(ClusterManager.ServiceType role, String hostname, RESTApiClusterManager.RoleCommand command)
private long doRoleCommand(String serviceName, String roleName, RESTApiClusterManager.RoleCommand roleCommand)
private RESTApiClusterManager.HealthSummary getHealthSummary(String serviceName, String roleType, String hostId)
private String getFromURIGet(URI uri)
private String getRoleName(String serviceName, String roleType, String hostId)
private String getRolePropertyValue(String serviceName, String roleType, String hostId, String property)
private RESTApiClusterManager.RoleState getRoleState(ClusterManager.ServiceType service, String hostname)
private RESTApiClusterManager.RoleState getRoleState(String serviceName, String roleType, String hostId)
private String getServiceName(RESTApiClusterManager.Service service)
private Optional<org.apache.hbase.thirdparty.com.google.gson.JsonObject> getCommand(long commandId)
private boolean hasCommandCompleted(long commandId)
true
if the commandId
has finished processing.private boolean hasCommandCompletedSuccessfully(long commandId)
true
if the commandId
has finished successfully.private <T> T executeWithRetries(Callable<T> callable)
private static Map<ClusterManager.ServiceType,RESTApiClusterManager.Service> buildRoleServiceTypeMap()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.