Package alluxio.master
Class MultiMasterLocalAlluxioCluster
- java.lang.Object
-
- alluxio.master.AbstractLocalAlluxioCluster
-
- alluxio.master.MultiMasterLocalAlluxioCluster
-
@NotThreadSafe public final class MultiMasterLocalAlluxioCluster extends AbstractLocalAlluxioCluster
A local Alluxio cluster with multiple masters.
-
-
Field Summary
-
Fields inherited from class alluxio.master.AbstractLocalAlluxioCluster
mHostname, mProxyProcess, mProxyThread, mWorkDirectory, mWorkers, mWorkerThreads
-
-
Constructor Summary
Constructors Constructor Description MultiMasterLocalAlluxioCluster(int numMasters)Runs a multi master local Alluxio cluster with a single worker.MultiMasterLocalAlluxioCluster(int numMasters, int numWorkers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description alluxio.client.file.FileSystemgetClient()Returns aFileSystemclient.alluxio.client.file.FileSystemgetClient(alluxio.client.file.FileSystemContext context)intgetLeaderIndex()LocalAlluxioMastergetLocalAlluxioMaster()java.util.List<java.net.InetSocketAddress>getMasterAddresses()java.lang.StringgetUri()voidinitConfiguration(java.lang.String name)Creates a defaultConfigurationfor testing.voidrestartZk()Restarts the cluster's Zookeeper service.protected voidstartMasters()Configures and starts the master(s).voidstartWorkers()Configures and starts the worker(s).voidstopFS()Stops the alluxio filesystem's service thread only.booleanstopLeader()Iterates over the masters in the order of master creation, stops the leader master.voidstopMasters()Stops the masters.booleanstopStandby()Iterates over the masters in the order of master creation, stops the first standby master.voidstopZk()Stops the cluster's Zookeeper service.voidwaitForNewMaster(int timeoutMs)Waits for a new master to start until a timeout occurs.-
Methods inherited from class alluxio.master.AbstractLocalAlluxioCluster
formatAndRestartMasters, getProxyProcess, isStartedWorkers, reset, resetClientPools, restartMasters, setAlluxioWorkDirectory, setHostname, setupTest, start, startProxy, stop, stopProxy, stopWorkers, waitForMasterServing, waitForWorkersRegistered
-
-
-
-
Constructor Detail
-
MultiMasterLocalAlluxioCluster
public MultiMasterLocalAlluxioCluster(int numMasters)
Runs a multi master local Alluxio cluster with a single worker.- Parameters:
numMasters- the number masters to run
-
MultiMasterLocalAlluxioCluster
public MultiMasterLocalAlluxioCluster(int numMasters, int numWorkers)- Parameters:
numMasters- the number of masters to runnumWorkers- the number of workers to run
-
-
Method Detail
-
initConfiguration
public void initConfiguration(java.lang.String name) throws java.io.IOExceptionDescription copied from class:AbstractLocalAlluxioClusterCreates a defaultConfigurationfor testing.- Specified by:
initConfigurationin classAbstractLocalAlluxioCluster- Parameters:
name- the name of the test/cluster- Throws:
java.io.IOException
-
getClient
public alluxio.client.file.FileSystem getClient() throws java.io.IOExceptionDescription copied from class:AbstractLocalAlluxioClusterReturns aFileSystemclient.- Specified by:
getClientin classAbstractLocalAlluxioCluster- Returns:
- a
FileSystemclient - Throws:
java.io.IOException
-
getClient
public alluxio.client.file.FileSystem getClient(alluxio.client.file.FileSystemContext context) throws java.io.IOException- Specified by:
getClientin classAbstractLocalAlluxioCluster- Parameters:
context- the FileSystemContext to use- Returns:
- a
FileSystemclient, using a specific context - Throws:
java.io.IOException
-
getUri
public java.lang.String getUri()
- Returns:
- the URI of the master
-
getLocalAlluxioMaster
public LocalAlluxioMaster getLocalAlluxioMaster()
- Specified by:
getLocalAlluxioMasterin classAbstractLocalAlluxioCluster- Returns:
- the local Alluxio master
-
getLeaderIndex
public int getLeaderIndex()
- Returns:
- index of leader master in
mMasters, or -1 if there is no leader temporarily
-
getMasterAddresses
public java.util.List<java.net.InetSocketAddress> getMasterAddresses()
- Returns:
- the master addresses
-
stopStandby
public boolean stopStandby()
Iterates over the masters in the order of master creation, stops the first standby master.- Returns:
- true if a standby master is successfully stopped, otherwise, false
-
stopLeader
public boolean stopLeader()
Iterates over the masters in the order of master creation, stops the leader master.- Returns:
- true if the leader master is successfully stopped, false otherwise
-
waitForNewMaster
public void waitForNewMaster(int timeoutMs) throws java.util.concurrent.TimeoutException, java.lang.InterruptedExceptionWaits for a new master to start until a timeout occurs.- Parameters:
timeoutMs- the number of milliseconds to wait before giving up and throwing an exception- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedException
-
stopZk
public void stopZk() throws java.lang.ExceptionStops the cluster's Zookeeper service.- Throws:
java.lang.Exception
-
restartZk
public void restartZk() throws java.lang.ExceptionRestarts the cluster's Zookeeper service. It must first be stopped withstopZk().- Throws:
java.lang.Exception
-
startMasters
protected void startMasters() throws java.io.IOExceptionDescription copied from class:AbstractLocalAlluxioClusterConfigures and starts the master(s).- Specified by:
startMastersin classAbstractLocalAlluxioCluster- Throws:
java.io.IOException
-
startWorkers
public void startWorkers() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterConfigures and starts the worker(s).- Overrides:
startWorkersin classAbstractLocalAlluxioCluster- Throws:
java.lang.Exception
-
stopFS
public void stopFS() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterStops the alluxio filesystem's service thread only.- Overrides:
stopFSin classAbstractLocalAlluxioCluster- Throws:
java.lang.Exception
-
stopMasters
public void stopMasters() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterStops the masters.- Specified by:
stopMastersin classAbstractLocalAlluxioCluster- Throws:
java.lang.Exception
-
-