Class MultiMasterLocalAlluxioCluster


  • @NotThreadSafe
    public final class MultiMasterLocalAlluxioCluster
    extends AbstractLocalAlluxioCluster
    A local Alluxio cluster with multiple masters.
    • 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 run
        numWorkers - the number of workers to run
    • Method Detail

      • initConfiguration

        public void initConfiguration​(java.lang.String name)
                               throws java.io.IOException
        Description copied from class: AbstractLocalAlluxioCluster
        Creates a default Configuration for testing.
        Specified by:
        initConfiguration in class AbstractLocalAlluxioCluster
        Parameters:
        name - the name of the test/cluster
        Throws:
        java.io.IOException
      • getClient

        public alluxio.client.file.FileSystem getClient​(alluxio.client.file.FileSystemContext context)
                                                 throws java.io.IOException
        Specified by:
        getClient in class AbstractLocalAlluxioCluster
        Parameters:
        context - the FileSystemContext to use
        Returns:
        a FileSystem client, using a specific context
        Throws:
        java.io.IOException
      • getUri

        public java.lang.String getUri()
        Returns:
        the URI of the 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.InterruptedException
        Waits 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.TimeoutException
        java.lang.InterruptedException
      • stopZk

        public void stopZk()
                    throws java.lang.Exception
        Stops the cluster's Zookeeper service.
        Throws:
        java.lang.Exception
      • restartZk

        public void restartZk()
                       throws java.lang.Exception
        Restarts the cluster's Zookeeper service. It must first be stopped with stopZk().
        Throws:
        java.lang.Exception