@ThreadSafe public final class MultiProcessCluster extends Object
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 | Field and Description |
---|---|
static String |
ALLUXIO_USE_FIXED_TEST_PORTS |
static int |
PORTS_PER_MASTER |
static int |
PORTS_PER_WORKER |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys the cluster.
|
void |
formatJournal()
Formats the cluster journal.
|
FileSystem |
getFileSystemClient() |
List<MasterNetAddress> |
getMasterAddresses() |
MasterInquireClient |
getMasterInquireClient() |
MetaMasterClient |
getMetaMasterClient() |
int |
getPrimaryMasterIndex(int timeoutMs)
Gets the index of the primary master.
|
static MultiProcessCluster.Builder |
newBuilder(List<PortCoordination.ReservedPort> reservedPorts) |
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,
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 static final String ALLUXIO_USE_FIXED_TEST_PORTS
public static final int PORTS_PER_MASTER
public static final int PORTS_PER_WORKER
public void start() throws Exception
Exception
public int waitForAndKillPrimaryMaster(int timeoutMs)
timeoutMs
- maximum amount of time to wait, in millisecondspublic int getPrimaryMasterIndex(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 IOException
IOException
public void destroy() throws IOException
IOException
public void startMasters()
public void startMaster(int i) throws IOException
i
- the index of the master to startIOException
public void startWorker(int i) throws IOException
i
- the index of the worker to startIOException
public void stopMasters()
public void stopMaster(int i) throws IOException
i
- the index of the master to stopIOException
public void updateMasterConf(PropertyKey key, @Nullable 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 IOException
i
- the index of the worker to stopIOException
public List<MasterNetAddress> getMasterAddresses()
public void stopZk() throws IOException
IOException
public void restartZk() throws Exception
Exception
public void formatJournal() throws IOException
IOException
public MasterInquireClient getMasterInquireClient()
public static MultiProcessCluster.Builder newBuilder(List<PortCoordination.ReservedPort> reservedPorts)
reservedPorts
- ports reserved for usage by this clusterMultiProcessCluster
Copyright © 2023. All Rights Reserved.