@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 |
addExternalMasterAddress(MasterNetAddress externalMasterAddress)
Updates internal master list with an external address.
|
void |
destroy()
Destroys the cluster.
|
void |
formatJournal()
Formats the cluster journal.
|
Clients |
getClients() |
MultiProcessCluster.DeployMode |
getDeployMode() |
FileSystem |
getFileSystemClient() |
FileSystemContext |
getFilesystemContext() |
String |
getJournalDir() |
JournalMasterClient |
getJournalMasterClientForMaster() |
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 all nodes to be registered.
|
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) throws TimeoutException, InterruptedException
timeoutMs
- maximum amount of time to wait, in millisecondsTimeoutException
InterruptedException
public int getPrimaryMasterIndex(int timeoutMs) throws TimeoutException, InterruptedException
timeoutMs
- maximum amount of time to wait, in millisecondsTimeoutException
InterruptedException
public void waitForAllNodesRegistered(int timeoutMs) throws TimeoutException, InterruptedException
timeoutMs
- maximum amount of time to wait, in millisecondsTimeoutException
InterruptedException
public MultiProcessCluster.DeployMode getDeployMode()
public FileSystemContext getFilesystemContext()
FileSystemContext
which can be used to access the clusterpublic FileSystem getFileSystemClient()
public MetaMasterClient getMetaMasterClient()
public JournalMasterClient getJournalMasterClientForMaster()
public Clients getClients()
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 addExternalMasterAddress(MasterNetAddress externalMasterAddress)
externalMasterAddress
- external master addresspublic 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 String getJournalDir()
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.