use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.
the class TestJoinedScanners method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
final int DEFAULT_BLOCK_SIZE = 1024 * 1024;
TEST_UTIL.getConfiguration().setLong("dfs.blocksize", DEFAULT_BLOCK_SIZE);
TEST_UTIL.getConfiguration().setInt("dfs.replication", 1);
TEST_UTIL.getConfiguration().setLong("hbase.hregion.max.filesize", 322122547200L);
String[] dataNodeHosts = new String[] { "host1", "host2", "host3" };
int regionServersCount = 3;
StartTestingClusterOption option = StartTestingClusterOption.builder().numRegionServers(regionServersCount).dataNodeHosts(dataNodeHosts).build();
TEST_UTIL.startMiniCluster(option);
}
use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.
the class MetaWithReplicasTestBase method startCluster.
protected static void startCluster() throws Exception {
TEST_UTIL.getConfiguration().setInt("zookeeper.session.timeout", 30000);
TEST_UTIL.getConfiguration().setInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 1000);
StartTestingClusterOption option = StartTestingClusterOption.builder().numAlwaysStandByMasters(1).numMasters(1).numRegionServers(REGIONSERVERS_COUNT).build();
TEST_UTIL.startMiniCluster(option);
Admin admin = TEST_UTIL.getAdmin();
HBaseTestingUtil.setReplicas(admin, TableName.META_TABLE_NAME, 3);
AssignmentManager am = TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager();
Set<ServerName> sns = new HashSet<ServerName>();
ServerName hbaseMetaServerName = am.getRegionStates().getRegionStateNode(RegionInfoBuilder.FIRST_META_REGIONINFO).getRegionLocation();
LOG.info("HBASE:META DEPLOY: on " + hbaseMetaServerName);
sns.add(hbaseMetaServerName);
for (int replicaId = 1; replicaId < 3; replicaId++) {
RegionInfo h = RegionReplicaUtil.getRegionInfoForReplica(RegionInfoBuilder.FIRST_META_REGIONINFO, replicaId);
AssignmentTestingUtil.waitForAssignment(am, h);
ServerName sn = am.getRegionStates().getRegionServerOfRegion(h);
assertNotNull(sn);
LOG.info("HBASE:META DEPLOY: " + h.getRegionNameAsString() + " on " + sn);
sns.add(sn);
}
// to fail ... sometimes.
if (sns.size() == 1) {
int count = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size();
assertTrue("count=" + count, count == REGIONSERVERS_COUNT);
LOG.warn("All hbase:meta replicas are on the one server; moving hbase:meta: " + sns);
int metaServerIndex = TEST_UTIL.getHBaseCluster().getServerWithMeta();
int newServerIndex = metaServerIndex;
while (newServerIndex == metaServerIndex) {
newServerIndex = (newServerIndex + 1) % REGIONSERVERS_COUNT;
}
assertNotEquals(metaServerIndex, newServerIndex);
ServerName destinationServerName = TEST_UTIL.getHBaseCluster().getRegionServer(newServerIndex).getServerName();
ServerName metaServerName = TEST_UTIL.getHBaseCluster().getRegionServer(metaServerIndex).getServerName();
assertNotEquals(destinationServerName, metaServerName);
TEST_UTIL.getAdmin().move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(), destinationServerName);
}
// Disable the balancer
LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(), new Abortable() {
AtomicBoolean aborted = new AtomicBoolean(false);
@Override
public boolean isAborted() {
return aborted.get();
}
@Override
public void abort(String why, Throwable e) {
aborted.set(true);
}
});
l.setBalancerOn(false);
LOG.debug("All meta replicas assigned");
}
use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.
the class TestRegionMoveAndAbandon method setup.
@Before
public void setup() throws Exception {
UTIL = new HBaseTestingUtil();
zkCluster = UTIL.startMiniZKCluster();
StartTestingClusterOption option = StartTestingClusterOption.builder().numRegionServers(2).build();
cluster = UTIL.startMiniHBaseCluster(option);
rs1 = cluster.getRegionServer(0);
rs2 = cluster.getRegionServer(1);
assertEquals(2, cluster.getRegionServerThreads().size());
tableName = TableName.valueOf(name.getMethodName());
UTIL.createTable(tableName, Bytes.toBytes("cf"));
UTIL.waitTableAvailable(tableName, 30_000);
regionInfo = Iterables.getOnlyElement(cluster.getRegions(tableName)).getRegionInfo();
}
use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.
the class TestRegionSplitAndSeparateChildren method setupCluster.
@BeforeClass
public static void setupCluster() throws Exception {
setupConf(UTIL.getConfiguration());
StartTestingClusterOption option = StartTestingClusterOption.builder().numMasters(1).numRegionServers(3).numDataNodes(3).build();
UTIL.startMiniCluster(option);
}
use of org.apache.hadoop.hbase.StartTestingClusterOption in project hbase by apache.
the class TestRegionMergeTransactionOnCluster method beforeAllTests.
@BeforeClass
public static void beforeAllTests() throws Exception {
// Start a cluster
StartTestingClusterOption option = StartTestingClusterOption.builder().masterClass(MyMaster.class).numRegionServers(NB_SERVERS).numDataNodes(NB_SERVERS).build();
TEST_UTIL.startMiniCluster(option);
SingleProcessHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
MASTER = cluster.getMaster();
MASTER.balanceSwitch(false);
ADMIN = TEST_UTIL.getConnection().getAdmin();
}
Aggregations