@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
|
protected class |
HBaseClusterManager.RemoteSudoShell
Executes commands over SSH
|
protected static class |
HBaseClusterManager.Signal |
(package private) static class |
HBaseClusterManager.ZookeeperShellCommandProvider
CommandProvider to manage the service using bin/zk* scripts.
|
ClusterManager.ServiceType
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEFAULT_RETRY_ATTEMPTS |
(package private) static int |
DEFAULT_RETRY_SLEEP_INTERVAL |
private static String |
DEFAULT_TUNNEL_CMD
The command format that is used to execute the remote command.
|
private static String |
DEFAULT_TUNNEL_SUDO_CMD
The command format that is used to execute the remote command with sudo.
|
protected static org.slf4j.Logger |
LOG |
(package private) static String |
RETRY_ATTEMPTS_KEY |
(package private) static String |
RETRY_SLEEP_INTERVAL_KEY |
protected org.apache.hadoop.hbase.util.RetryCounterFactory |
retryCounterFactory |
private String |
sshOptions |
private String |
sshUserName |
private String |
tunnelCmd |
private String |
tunnelSudoCmd |
Constructor and Description |
---|
HBaseClusterManager() |
Modifier and Type | Method and Description |
---|---|
private void |
exec(String hostname,
ClusterManager.ServiceType service,
HBaseClusterManager.CommandProvider.Operation op) |
protected 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
|
org.apache.hadoop.hbase.util.Pair<Integer,String> |
execSudo(String hostname,
long timeout,
String... cmd)
Execute the given command on the host using SSH
|
org.apache.hadoop.hbase.util.Pair<Integer,String> |
execSudoWithRetries(String hostname,
long timeout,
String... cmd) |
private org.apache.hadoop.hbase.util.Pair<Integer,String> |
execWithRetries(String hostname,
ClusterManager.ServiceType service,
String... cmd) |
protected HBaseClusterManager.CommandProvider |
getCommandProvider(ClusterManager.ServiceType service) |
protected 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,
HBaseClusterManager.Signal 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
|
protected static final org.slf4j.Logger LOG
private String sshUserName
private String sshOptions
private static final String DEFAULT_TUNNEL_CMD
private static final String DEFAULT_TUNNEL_SUDO_CMD
private String tunnelSudoCmd
static final String RETRY_ATTEMPTS_KEY
static final int DEFAULT_RETRY_ATTEMPTS
static final String RETRY_SLEEP_INTERVAL_KEY
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
protected String getServiceUser(ClusterManager.ServiceType service)
protected HBaseClusterManager.CommandProvider getCommandProvider(ClusterManager.ServiceType service) throws IOException
IOException
protected 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
public org.apache.hadoop.hbase.util.Pair<Integer,String> execSudo(String hostname, long timeout, String... cmd) throws IOException
IOException
- if something goes wrong.public org.apache.hadoop.hbase.util.Pair<Integer,String> execSudoWithRetries(String hostname, long timeout, 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, HBaseClusterManager.Signal 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–2021 The Apache Software Foundation. All rights reserved.