Package org.apache.accumulo.minicluster
Class MiniAccumuloCluster
java.lang.Object
org.apache.accumulo.minicluster.MiniAccumuloCluster
A utility class that will create Zookeeper and Accumulo processes that write all of their data to
a single local directory. This class makes it easy to test code against a real Accumulo instance.
The use of this utility will yield results which closely match a normal Accumulo instance.
- Since:
- 1.5.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetConnector
(String user, String passwd) Utility method to get a connector to the MAC.Set<org.apache.accumulo.core.util.Pair<ServerType,
Integer>> void
start()
Starts Accumulo and Zookeeper processes.void
stop()
Stops Accumulo and Zookeeper processes.
-
Constructor Details
-
MiniAccumuloCluster
- Parameters:
dir
- An empty or nonexistant temp directoy that Accumulo and Zookeeper can store data in. Creating the directory is left to the user. Java 7, Guava, and Junit provide methods for creating temporary directories.rootPassword
- Initial root password for instance.- Throws:
IOException
-
MiniAccumuloCluster
- Parameters:
config
- initial configuration- Throws:
IOException
-
-
Method Details
-
start
Starts Accumulo and Zookeeper processes. Can only be called once.- Throws:
IOException
InterruptedException
-
getDebugPorts
- Returns:
- generated remote debug ports if in debug mode.
- Since:
- 1.6.0
-
getInstanceName
- Returns:
- Accumulo instance name
-
getZooKeepers
- Returns:
- zookeeper connection string
-
stop
Stops Accumulo and Zookeeper processes. If stop is not called, there is a shutdown hook that is setup to kill the processes. However its probably best to call stop in a finally block as soon as possible.- Throws:
IOException
InterruptedException
-
getConfig
- Since:
- 1.6.0
-
getConnector
public Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException Utility method to get a connector to the MAC.- Throws:
AccumuloException
AccumuloSecurityException
- Since:
- 1.6.0
-
getClientConfig
- Since:
- 1.6.0
-