Package alluxio.master
Class LocalAlluxioCluster
- java.lang.Object
-
- alluxio.master.AbstractLocalAlluxioCluster
-
- alluxio.master.LocalAlluxioCluster
-
@NotThreadSafe public final class LocalAlluxioCluster extends AbstractLocalAlluxioCluster
Local Alluxio cluster for integration tests. Example to use// Create a cluster instance localAlluxioCluster = new LocalAlluxioCluster(WORKER_CAPACITY_BYTES, BLOCK_SIZE_BYTES); // If you have special conf parameter to set for integration tests: AlluxioConfiguration testConf = localAlluxioCluster.newTestConf(); testConf.set(Constants.USER_FILE_BUFFER_BYTES, String.valueOf(BUFFER_BYTES)); // After setting up the test conf, start this local cluster: localAlluxioCluster.start(testConf);
-
-
Field Summary
-
Fields inherited from class alluxio.master.AbstractLocalAlluxioCluster
mHostname, mProxyProcess, mProxyThread, mWorkDirectory, mWorkers, mWorkerThreads
-
-
Constructor Summary
Constructors Constructor Description LocalAlluxioCluster()Runs a test Alluxio cluster with a single Alluxio worker.LocalAlluxioCluster(int numWorkers, boolean includeSecondary)LocalAlluxioCluster(int numWorkers, boolean includeSecondary, boolean includeProxy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlluxioHome()alluxio.client.file.FileSystemgetClient()Returns aFileSystemclient.alluxio.client.file.FileSystemgetClient(alluxio.client.file.FileSystemContext context)java.lang.StringgetHostname()LocalAlluxioMastergetLocalAlluxioMaster()intgetMasterRpcPort()java.lang.StringgetMasterURI()alluxio.wire.WorkerNetAddressgetWorkerAddress()alluxio.worker.WorkerProcessgetWorkerProcess()voidinitConfiguration(java.lang.String name)Creates a defaultConfigurationfor testing.voidstartMasters()Configures and starts the master(s).protected voidstartProxy()Configures and starts the proxy.voidstop()Stops both the alluxio and underfs service threads.voidstopMasters()Stops the masters.-
Methods inherited from class alluxio.master.AbstractLocalAlluxioCluster
formatAndRestartMasters, getProxyProcess, isStartedWorkers, reset, resetClientPools, restartMasters, setAlluxioWorkDirectory, setHostname, setupTest, start, startWorkers, stopFS, stopProxy, stopWorkers, waitForMasterServing, waitForWorkersRegistered
-
-
-
-
Constructor Detail
-
LocalAlluxioCluster
public LocalAlluxioCluster()
Runs a test Alluxio cluster with a single Alluxio worker.
-
LocalAlluxioCluster
public LocalAlluxioCluster(int numWorkers, boolean includeSecondary, boolean includeProxy)- Parameters:
numWorkers- the number of workers to runincludeSecondary- weather to include the secondary masterincludeProxy- weather to include the proxy
-
LocalAlluxioCluster
public LocalAlluxioCluster(int numWorkers, boolean includeSecondary)- Parameters:
numWorkers- the number of workers to runincludeSecondary- weather to include the secondary master
-
-
Method Detail
-
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
-
getLocalAlluxioMaster
public LocalAlluxioMaster getLocalAlluxioMaster()
- Specified by:
getLocalAlluxioMasterin classAbstractLocalAlluxioCluster- Returns:
- the local Alluxio master
-
getHostname
public java.lang.String getHostname()
- Returns:
- the hostname of the cluster
-
getMasterURI
public java.lang.String getMasterURI()
- Returns:
- the URI of the master
-
getMasterRpcPort
public int getMasterRpcPort()
- Returns:
- the RPC port of the master
-
getAlluxioHome
public java.lang.String getAlluxioHome()
- Returns:
- the home path to Alluxio
-
getWorkerProcess
public alluxio.worker.WorkerProcess getWorkerProcess()
- Returns:
- the first worker
-
getWorkerAddress
public alluxio.wire.WorkerNetAddress getWorkerAddress()
- Returns:
- the address of the first worker
-
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
-
startMasters
public void startMasters() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterConfigures and starts the master(s).- Specified by:
startMastersin classAbstractLocalAlluxioCluster- Throws:
java.lang.Exception
-
startProxy
protected void startProxy() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterConfigures and starts the proxy.- Overrides:
startProxyin classAbstractLocalAlluxioCluster- Throws:
java.lang.Exception
-
stop
public void stop() throws java.lang.ExceptionDescription copied from class:AbstractLocalAlluxioClusterStops both the alluxio and underfs service threads.- Overrides:
stopin 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
-
-