@ThreadSafe
public final class MultiProcessCluster
extends java.lang.Object
implements org.junit.rules.TestRule
LocalAlluxioCluster, MultiProcessCluster is
- Slower
- Black box testing only (No access to master/worker internals)
- Destructible (You can kill -9 masters/workers)
- More realistic of real deployments
Due to the slower speed, [@link LocalAlluxioCluster} should generally be preferred.
MultiProcessCluster is primarily for tests which want to stop or restart servers.
The synchronization strategy for this class is to synchronize all public methods.| Modifier and Type | Class and Description |
|---|---|
static class |
MultiProcessCluster.Builder
Builder for
MultiProcessCluster. |
static class |
MultiProcessCluster.DeployMode
Deploy mode for the cluster.
|
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
void |
destroy()
Destroys the cluster.
|
void |
formatJournal()
Formats the cluster journal.
|
FileSystem |
getFileSystemClient() |
java.util.List<MasterNetAddress> |
getMasterAddresses() |
MasterInquireClient |
getMasterInquireClient() |
MetaMasterClient |
getMetaMasterClient() |
static MultiProcessCluster.Builder |
newBuilder() |
void |
notifySuccess()
Informs the cluster that the test succeeded.
|
void |
restartZk()
Restarts the Zookeeper cluster.
|
void |
saveWorkdir()
Copies the work directory to the artifacts folder.
|
void |
start()
Starts the cluster, launching all server processes.
|
void |
startMaster(int i)
Starts the specified master.
|
void |
startMasters()
Starts all masters.
|
void |
startWorker(int i)
Starts the specified worker.
|
void |
stopMaster(int i) |
void |
stopMasters()
Stops all masters.
|
void |
stopWorker(int i) |
void |
stopZk()
Stops the Zookeeper cluster.
|
void |
updateDeployMode(MultiProcessCluster.DeployMode mode)
Updates the cluster's deploy mode.
|
void |
updateMasterConf(PropertyKey key,
java.lang.String value)
Updates master configuration for all masters.
|
void |
waitForAllNodesRegistered(int timeoutMs)
Waits for the number of live nodes in server configuration store
reached the number of nodes in this cluster and gets meta master client.
|
int |
waitForAndKillPrimaryMaster(int timeoutMs)
Kills the primary master.
|
public void start()
throws java.lang.Exception
java.lang.Exceptionpublic int waitForAndKillPrimaryMaster(int timeoutMs)
timeoutMs - maximum amount of time to wait, in millisecondspublic void waitForAllNodesRegistered(int timeoutMs)
timeoutMs - maximum amount of time to wait, in millisecondspublic FileSystem getFileSystemClient()
public MetaMasterClient getMetaMasterClient()
public void notifySuccess()
public void saveWorkdir()
throws java.io.IOException
java.io.IOExceptionpublic void destroy()
throws java.io.IOException
java.io.IOExceptionpublic void startMasters()
public void startMaster(int i)
throws java.io.IOException
i - the index of the master to startjava.io.IOExceptionpublic void startWorker(int i)
throws java.io.IOException
i - the index of the worker to startjava.io.IOExceptionpublic void stopMasters()
public void stopMaster(int i)
throws java.io.IOException
i - the index of the master to stopjava.io.IOExceptionpublic void updateMasterConf(PropertyKey key, @Nullable java.lang.String value)
key - the key to updatevalue - the value to set, or null to unset the keypublic void updateDeployMode(MultiProcessCluster.DeployMode mode)
mode - the mode to setpublic void stopWorker(int i)
throws java.io.IOException
i - the index of the worker to stopjava.io.IOExceptionpublic java.util.List<MasterNetAddress> getMasterAddresses()
public void stopZk()
throws java.io.IOException
java.io.IOExceptionpublic void restartZk()
throws java.lang.Exception
java.lang.Exceptionpublic void formatJournal()
throws java.io.IOException
java.io.IOExceptionpublic MasterInquireClient getMasterInquireClient()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic static MultiProcessCluster.Builder newBuilder()
MultiProcessClusterCopyright © 2018. All Rights Reserved.