Search in sources :

Example 26 with StartTestingClusterOption

use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.

the class TestTableSnapshotScanner method setupCluster.

public void setupCluster() throws Exception {
    setupConf(UTIL.getConfiguration());
    StartTestingClusterOption option = StartTestingClusterOption.builder().numRegionServers(NUM_REGION_SERVERS).numDataNodes(NUM_REGION_SERVERS).createRootDir(true).build();
    UTIL.startMiniCluster(option);
    rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
    fs = rootDir.getFileSystem(UTIL.getConfiguration());
}
Also used : StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption)

Example 27 with StartTestingClusterOption

use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.

the class TestFailedMetaReplicaAssigment method setUp.

@BeforeClass
public static void setUp() throws Exception {
    // using our rigged master, to force a failed meta replica assignment when start up master
    // this test can be removed once we remove the HConstants.META_REPLICAS_NUM config.
    Configuration conf = TEST_UTIL.getConfiguration();
    conf.setInt(HConstants.META_REPLICAS_NUM, 3);
    StartTestingClusterOption option = StartTestingClusterOption.builder().numAlwaysStandByMasters(1).numMasters(1).numRegionServers(1).masterClass(BrokenMetaReplicaMaster.class).build();
    TEST_UTIL.startMiniCluster(option);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) BeforeClass(org.junit.BeforeClass)

Example 28 with StartTestingClusterOption

use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.

the class TestClusterId method testClusterId.

@Test
public void testClusterId() throws Exception {
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.startMiniDFSCluster(1);
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    // start region server, needs to be separate
    // so we get an unset clusterId
    rst = JVMClusterUtil.createRegionServerThread(conf, HRegionServer.class, 0);
    rst.start();
    // Make sure RS is in blocking state
    Thread.sleep(10000);
    StartTestingClusterOption option = StartTestingClusterOption.builder().numMasters(1).numRegionServers(0).build();
    TEST_UTIL.startMiniHBaseCluster(option);
    rst.waitForServerOnline();
    String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
    assertNotNull(clusterId);
    assertEquals(clusterId, rst.getRegionServer().getClusterId());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) Test(org.junit.Test)

Example 29 with StartTestingClusterOption

use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.

the class TestRSGroupsOfflineMode method setUp.

@BeforeClass
public static void setUp() throws Exception {
    TEST_UTIL = new HBaseTestingUtil();
    RSGroupUtil.enableRSGroup(TEST_UTIL.getConfiguration());
    TEST_UTIL.getConfiguration().set(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, "1");
    StartTestingClusterOption option = StartTestingClusterOption.builder().numMasters(2).numRegionServers(3).numDataNodes(3).build();
    TEST_UTIL.startMiniCluster(option);
    cluster = TEST_UTIL.getHBaseCluster();
    master = ((SingleProcessHBaseCluster) cluster).getMaster();
    master.balanceSwitch(false);
    hbaseAdmin = TEST_UTIL.getAdmin();
    // wait till the balancer is in online mode
    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {

        @Override
        public boolean evaluate() throws Exception {
            return master.isInitialized() && ((RSGroupBasedLoadBalancer) master.getLoadBalancer()).isOnline() && master.getServerManager().getOnlineServersList().size() >= 3;
        }
    });
}
Also used : HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) Waiter(org.apache.hadoop.hbase.Waiter) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) BeforeClass(org.junit.BeforeClass)

Example 30 with StartTestingClusterOption

use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.

the class TestGetReplicationLoad method startCluster.

@BeforeClass
public static void startCluster() throws Exception {
    LOG.info("Starting cluster");
    TEST_UTIL = new HBaseTestingUtil();
    // Set master class and use default values for other options.
    StartTestingClusterOption option = StartTestingClusterOption.builder().masterClass(TestMasterMetrics.MyMaster.class).build();
    TEST_UTIL.startMiniCluster(option);
    cluster = TEST_UTIL.getHBaseCluster();
    LOG.info("Waiting for active/ready master");
    cluster.waitForActiveAndReadyMaster();
    master = cluster.getMaster();
}
Also used : HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) BeforeClass(org.junit.BeforeClass)

Aggregations

StartTestingClusterOption (org.apache.hadoop.hbase.StartTestingClusterOption)42 BeforeClass (org.junit.BeforeClass)21 HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)13 Test (org.junit.Test)13 Configuration (org.apache.hadoop.conf.Configuration)10 SingleProcessHBaseCluster (org.apache.hadoop.hbase.SingleProcessHBaseCluster)8 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)5 TableName (org.apache.hadoop.hbase.TableName)5 Table (org.apache.hadoop.hbase.client.Table)5 MasterThread (org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread)5 ServerName (org.apache.hadoop.hbase.ServerName)4 RegionLocator (org.apache.hadoop.hbase.client.RegionLocator)4 Path (org.apache.hadoop.fs.Path)3 ClusterMetrics (org.apache.hadoop.hbase.ClusterMetrics)3 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)3 Before (org.junit.Before)3 InetAddress (java.net.InetAddress)2 NetworkInterface (java.net.NetworkInterface)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2