@InterfaceAudience.Private public class HBaseClusterManager extends org.apache.hadoop.conf.Configured implements ClusterManager
Modifier and Type | Class and Description |
---|---|
(package private) static class |
HBaseClusterManager.CommandProvider
Provides command strings for services to be executed by Shell.
|
(package private) static class |
HBaseClusterManager.HadoopShellCommandProvider
CommandProvider to manage the service using sbin/hadoop-* scripts.
|
(package private) static class |
HBaseClusterManager.HBaseShellCommandProvider
CommandProvider to manage the service using bin/hbase-* scripts
|
protected class |
HBaseClusterManager.RemoteShell
Executes commands over SSH
|
(package private) static class |
HBaseClusterManager.ZookeeperShellCommandProvider
CommandProvider to manage the service using bin/zk* scripts.
|
ClusterManager.ServiceType
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_RETRY_ATTEMPTS |
private static int |
DEFAULT_RETRY_SLEEP_INTERVAL |
private static String |
DEFAULT_TUNNEL_CMD
The command format that is used to execute the remote command.
|
protected static org.slf4j.Logger |
LOG |
private static String |
RETRY_ATTEMPTS_KEY |
private static String |
RETRY_SLEEP_INTERVAL_KEY |
protected org.apache.hadoop.hbase.util.RetryCounterFactory |
retryCounterFactory |
private static String |
SIGCONT |
private static String |
SIGKILL |
private static String |
SIGSTOP |
private String |
sshOptions |
private String |
sshUserName |
private String |
tunnelCmd |
Constructor and Description |
---|
HBaseClusterManager() |
Modifier and Type | Method and Description |
---|---|
private void |
exec(String hostname,
ClusterManager.ServiceType service,
HBaseClusterManager.CommandProvider.Operation op) |
private org.apache.hadoop.hbase.util.Pair<Integer,String> |
exec(String hostname,
ClusterManager.ServiceType service,
String... cmd)
Execute the given command on the host using SSH
|
private org.apache.hadoop.hbase.util.Pair<Integer,String> |
execWithRetries(String hostname,
ClusterManager.ServiceType service,
String... cmd) |
protected HBaseClusterManager.CommandProvider |
getCommandProvider(ClusterManager.ServiceType service) |
private String |
getServiceUser(ClusterManager.ServiceType 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
|
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
|
private <E extends Exception> |
retryOrThrow(org.apache.hadoop.hbase.util.RetryCounter retryCounter,
E ex,
String hostname,
String[] cmd) |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
signal(ClusterManager.ServiceType service,
String signal,
String hostname) |
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 SIGKILL
private static final String SIGSTOP
private static final String SIGCONT
protected static final org.slf4j.Logger LOG
private String sshUserName
private String sshOptions
private static final String DEFAULT_TUNNEL_CMD
private static final String RETRY_ATTEMPTS_KEY
private static final int DEFAULT_RETRY_ATTEMPTS
private static final String RETRY_SLEEP_INTERVAL_KEY
private static final int DEFAULT_RETRY_SLEEP_INTERVAL
protected org.apache.hadoop.hbase.util.RetryCounterFactory retryCounterFactory
public HBaseClusterManager()
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
private String getServiceUser(ClusterManager.ServiceType service)
protected HBaseClusterManager.CommandProvider getCommandProvider(ClusterManager.ServiceType service) throws IOException
IOException
private org.apache.hadoop.hbase.util.Pair<Integer,String> exec(String hostname, ClusterManager.ServiceType service, String... cmd) throws IOException
IOException
- if something goes wrong.private org.apache.hadoop.hbase.util.Pair<Integer,String> execWithRetries(String hostname, ClusterManager.ServiceType service, String... cmd) throws IOException
IOException
private <E extends Exception> void retryOrThrow(org.apache.hadoop.hbase.util.RetryCounter retryCounter, E ex, String hostname, String[] cmd) throws E extends Exception
E extends Exception
private void exec(String hostname, ClusterManager.ServiceType service, HBaseClusterManager.CommandProvider.Operation op) throws IOException
IOException
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 void signal(ClusterManager.ServiceType service, String signal, String hostname) throws IOException
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
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.