Class StandaloneClusterControl
- java.lang.Object
-
- org.apache.accumulo.cluster.standalone.StandaloneClusterControl
-
- All Implemented Interfaces:
ClusterControl
public class StandaloneClusterControl extends Object implements ClusterControl
Use theRemoteShellto control a standalone (possibly distributed) Accumulo instance
-
-
Field Summary
Fields Modifier and Type Field Description protected StringaccumuloPathprotected StringaccumuloServicePathprotected RemoteShellOptionsoptions
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadminStopAll()Issue an orderly shutdown of the cluster, throws an exception if it fails to return successfully (return value of 0).intexec(Class<?> clz, String[] args)Execute the given class against the cluster with the provided arguments and waits for completion.protected Map.Entry<Integer,String>exec(String hostname, String[] command)Map.Entry<Integer,String>execWithStdout(Class<?> clz, String[] args)Execute the given class against the cluster with the provided arguments and waits for completion.protected FilegetClientConfDir()protected List<String>getHosts(File f)Read the provided file and return all lines which don't start with a '#' characterprotected List<String>getHosts(String fn)Read hosts in file named by 'fn' in Accumulo conf dirprotected StringgetPid(ServerType server, String accumuloHome, String hostname)protected String[]getPidCommand(ServerType server, String accumuloHome)protected StringgetProcessString(ServerType server)protected FilegetServerConfDir()voidkill(ServerType server, String hostname)Send SIGKILL to the given process on the hostvoidresume(ServerType server, String hostname)Send SIGCONT to the given process on the hostvoidsetGoalState(String goalState)Wrapper around SetGoalStatevoidsignal(ServerType server, String hostname, String signal)Send the provided signal to the process on the hostvoidstart(ServerType server, String hostname)Start the given process on the hostvoidstartAllServers(ServerType server)Starts all occurrences of the given servervoidstop(ServerType server, String hostname)Stop the given process on the hostvoidstopAllServers(ServerType server)Stops all occurrences of the given servervoidsuspend(ServerType server, String hostname)Send SIGSTOP to the given process on the host
-
-
-
Field Detail
-
options
protected RemoteShellOptions options
-
accumuloServicePath
protected String accumuloServicePath
-
accumuloPath
protected String accumuloPath
-
-
Method Detail
-
exec
protected Map.Entry<Integer,String> exec(String hostname, String[] command) throws IOException
- Throws:
IOException
-
exec
public int exec(Class<?> clz, String[] args) throws IOException
Description copied from interface:ClusterControlExecute the given class against the cluster with the provided arguments and waits for completion. Returns the exit code of the process.- Specified by:
execin interfaceClusterControl- Throws:
IOException
-
execWithStdout
public Map.Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) throws IOException
Description copied from interface:ClusterControlExecute the given class against the cluster with the provided arguments and waits for completion. Returns the exit code of the process with the stdout.- Specified by:
execWithStdoutin interfaceClusterControl- Throws:
IOException
-
adminStopAll
public void adminStopAll() throws IOExceptionDescription copied from interface:ClusterControlIssue an orderly shutdown of the cluster, throws an exception if it fails to return successfully (return value of 0).- Specified by:
adminStopAllin interfaceClusterControl- Throws:
IOException
-
setGoalState
public void setGoalState(String goalState) throws IOException
Wrapper around SetGoalState- Parameters:
goalState- The goal state to set- Throws:
IOException- If SetGoalState returns a non-zero result
-
startAllServers
public void startAllServers(ServerType server) throws IOException
Description copied from interface:ClusterControlStarts all occurrences of the given server- Specified by:
startAllServersin interfaceClusterControl- Throws:
IOException
-
start
public void start(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControlStart the given process on the host- Specified by:
startin interfaceClusterControl- Throws:
IOException
-
stopAllServers
public void stopAllServers(ServerType server) throws IOException
Description copied from interface:ClusterControlStops all occurrences of the given server- Specified by:
stopAllServersin interfaceClusterControl- Throws:
IOException
-
stop
public void stop(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControlStop the given process on the host- Specified by:
stopin interfaceClusterControl- Throws:
IOException
-
signal
public void signal(ServerType server, String hostname, String signal) throws IOException
Description copied from interface:ClusterControlSend the provided signal to the process on the host- Specified by:
signalin interfaceClusterControl- Throws:
IOException
-
suspend
public void suspend(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControlSend SIGSTOP to the given process on the host- Specified by:
suspendin interfaceClusterControl- Throws:
IOException
-
resume
public void resume(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControlSend SIGCONT to the given process on the host- Specified by:
resumein interfaceClusterControl- Throws:
IOException
-
kill
public void kill(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControlSend SIGKILL to the given process on the host- Specified by:
killin interfaceClusterControl- Throws:
IOException
-
getPid
protected String getPid(ServerType server, String accumuloHome, String hostname) throws IOException
- Throws:
IOException
-
getPidCommand
protected String[] getPidCommand(ServerType server, String accumuloHome)
-
getProcessString
protected String getProcessString(ServerType server)
-
getClientConfDir
protected File getClientConfDir()
-
getServerConfDir
protected File getServerConfDir()
-
getHosts
protected List<String> getHosts(String fn) throws IOException
Read hosts in file named by 'fn' in Accumulo conf dir- Throws:
IOException
-
getHosts
protected List<String> getHosts(File f) throws IOException
Read the provided file and return all lines which don't start with a '#' character- Throws:
IOException
-
-