Class StandaloneClusterControl
- java.lang.Object
-
- org.apache.accumulo.cluster.standalone.StandaloneClusterControl
-
- All Implemented Interfaces:
ClusterControl
public class StandaloneClusterControl extends Object implements ClusterControl
Use theRemoteShell
to control a standalone (possibly distributed) Accumulo instance
-
-
Field Summary
Fields Modifier and Type Field Description protected String
accumuloPath
protected String
accumuloServicePath
protected RemoteShellOptions
options
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adminStopAll()
Issue an orderly shutdown of the cluster, throws an exception if it fails to return successfully (return value of 0).int
exec(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 File
getClientConfDir()
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 String
getPid(ServerType server, String accumuloHome, String hostname)
protected String[]
getPidCommand(ServerType server, String accumuloHome)
protected String
getProcessString(ServerType server)
protected File
getServerConfDir()
void
kill(ServerType server, String hostname)
Send SIGKILL to the given process on the hostvoid
resume(ServerType server, String hostname)
Send SIGCONT to the given process on the hostvoid
setGoalState(String goalState)
Wrapper around SetGoalStatevoid
signal(ServerType server, String hostname, String signal)
Send the provided signal to the process on the hostvoid
start(ServerType server, String hostname)
Start the given process on the hostvoid
startAllServers(ServerType server)
Starts all occurrences of the given servervoid
startCompactors(Class<? extends Compactor> compactor, int limit, String queueName)
Start instances of Compactorsvoid
startCoordinator(Class<? extends CompactionCoordinator> coordinator)
Start an instance of CompactionCoordinatorvoid
stop(ServerType server, String hostname)
Stop the given process on the hostvoid
stopAllServers(ServerType server)
Stops all occurrences of the given servervoid
suspend(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:ClusterControl
Execute the given class against the cluster with the provided arguments and waits for completion. Returns the exit code of the process.- Specified by:
exec
in interfaceClusterControl
- Throws:
IOException
-
execWithStdout
public Map.Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) throws IOException
Description copied from interface:ClusterControl
Execute 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:
execWithStdout
in interfaceClusterControl
- Throws:
IOException
-
adminStopAll
public void adminStopAll() throws IOException
Description copied from interface:ClusterControl
Issue an orderly shutdown of the cluster, throws an exception if it fails to return successfully (return value of 0).- Specified by:
adminStopAll
in 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:ClusterControl
Starts all occurrences of the given server- Specified by:
startAllServers
in interfaceClusterControl
- Throws:
IOException
-
start
public void start(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControl
Start the given process on the host- Specified by:
start
in interfaceClusterControl
- Throws:
IOException
-
stopAllServers
public void stopAllServers(ServerType server) throws IOException
Description copied from interface:ClusterControl
Stops all occurrences of the given server- Specified by:
stopAllServers
in interfaceClusterControl
- Throws:
IOException
-
stop
public void stop(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControl
Stop the given process on the host- Specified by:
stop
in interfaceClusterControl
- Throws:
IOException
-
signal
public void signal(ServerType server, String hostname, String signal) throws IOException
Description copied from interface:ClusterControl
Send the provided signal to the process on the host- Specified by:
signal
in interfaceClusterControl
- Throws:
IOException
-
suspend
public void suspend(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControl
Send SIGSTOP to the given process on the host- Specified by:
suspend
in interfaceClusterControl
- Throws:
IOException
-
resume
public void resume(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControl
Send SIGCONT to the given process on the host- Specified by:
resume
in interfaceClusterControl
- Throws:
IOException
-
kill
public void kill(ServerType server, String hostname) throws IOException
Description copied from interface:ClusterControl
Send SIGKILL to the given process on the host- Specified by:
kill
in 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
-
startCompactors
public void startCompactors(Class<? extends Compactor> compactor, int limit, String queueName) throws IOException
Description copied from interface:ClusterControl
Start instances of Compactors- Specified by:
startCompactors
in interfaceClusterControl
- Parameters:
compactor
- compactor classlimit
- number of compactors to startqueueName
- name of queue- Throws:
IOException
-
startCoordinator
public void startCoordinator(Class<? extends CompactionCoordinator> coordinator) throws IOException
Description copied from interface:ClusterControl
Start an instance of CompactionCoordinator- Specified by:
startCoordinator
in interfaceClusterControl
- Parameters:
coordinator
- compaction coordinator class- Throws:
IOException
-
-