public class RESTApiClusterManager extends org.apache.hadoop.conf.Configured implements ClusterManager
Modifier and Type | Class and Description |
---|---|
private static class |
RESTApiClusterManager.RoleCommand |
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 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 Map<ClusterManager.ServiceType,RESTApiClusterManager.Service> |
roleServiceType |
private String |
serverHostname |
private String |
serverPassword |
private String |
serverUsername |
Constructor and Description |
---|
RESTApiClusterManager() |
Modifier and Type | Method and Description |
---|---|
private void |
doRoleCommand(String serviceName,
String roleName,
RESTApiClusterManager.RoleCommand roleCommand) |
private String |
getHealthSummary(String serviceName,
String roleType,
String hostId) |
private String |
getHostId(String hostname) |
private com.fasterxml.jackson.databind.JsonNode |
getJsonNodeFromURIGet(URI uri) |
private String |
getRoleName(String serviceName,
String roleType,
String hostId) |
private String |
getRolePropertyValue(String serviceName,
String roleType,
String hostId,
String property) |
private String |
getRoleState(String serviceName,
String roleType,
String hostId) |
private String |
getServiceName(RESTApiClusterManager.Service service) |
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 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 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 serverUsername
private String serverPassword
private String clusterName
private static final String API_VERSION
private javax.ws.rs.client.Client client
private ClusterManager hBaseClusterManager
private static final org.slf4j.Logger LOG
private static 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) throws IOException
ClusterManager
start
in interface ClusterManager
IOException
public void stop(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
stop
in interface ClusterManager
IOException
public void restart(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
restart
in interface ClusterManager
IOException
public boolean isRunning(ClusterManager.ServiceType service, String hostname, int port) throws IOException
ClusterManager
isRunning
in interface ClusterManager
IOException
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) throws IOException
IOException
private void doRoleCommand(String serviceName, String roleName, RESTApiClusterManager.RoleCommand roleCommand)
private String getHealthSummary(String serviceName, String roleType, String hostId) throws IOException
IOException
private String getHostId(String hostname) throws IOException
IOException
private com.fasterxml.jackson.databind.JsonNode getJsonNodeFromURIGet(URI uri) throws IOException
IOException
private String getRoleName(String serviceName, String roleType, String hostId) throws IOException
IOException
private String getRolePropertyValue(String serviceName, String roleType, String hostId, String property) throws IOException
IOException
private String getRoleState(String serviceName, String roleType, String hostId) throws IOException
IOException
private String getServiceName(RESTApiClusterManager.Service service) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.