本文整理汇总了Java中org.apache.hadoop.hbase.LocalHBaseCluster类的典型用法代码示例。如果您正苦于以下问题:Java LocalHBaseCluster类的具体用法?Java LocalHBaseCluster怎么用?Java LocalHBaseCluster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocalHBaseCluster类属于org.apache.hadoop.hbase包,在下文中一共展示了LocalHBaseCluster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private int start() throws Exception {
Configuration conf = getConf();
HRegionServer.loadWinterConf(conf, null);
CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
try {
// If 'local', don't start a region server here. Defer to
// LocalHBaseCluster. It manages 'local' clusters.
if (LocalHBaseCluster.isLocal(conf)) {
LOG.warn("Not starting a distinct region server because " + HConstants.CLUSTER_DISTRIBUTED
+ " is false");
} else {
logProcessInfo(getConf());
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf, cp);
hrs.start();
hrs.join();
if (hrs.isAborted()) {
throw new RuntimeException("HRegionServer Aborted");
}
}
} catch (Throwable t) {
LOG.error("Region server exiting", t);
return 1;
}
return 0;
}
示例2: setUp
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
Properties conf = MiniKdc.createConf();
conf.put(MiniKdc.DEBUG, true);
KDC = new MiniKdc(conf, new File(TEST_UTIL.getDataTestDir("kdc").toUri().getPath()));
KDC.start();
USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
PRINCIPAL = USERNAME + "/" + HOST;
HTTP_PRINCIPAL = "HTTP/" + HOST;
KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
TEST_UTIL.startMiniZKCluster();
HBaseKerberosUtils.setKeytabFileForTesting(KEYTAB_FILE.getAbsolutePath());
HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration());
setHdfsSecuredConfiguration(TEST_UTIL.getConfiguration());
UserGroupInformation.setConfiguration(TEST_UTIL.getConfiguration());
TEST_UTIL.getConfiguration().setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
TokenProvider.class.getName());
TEST_UTIL.startMiniDFSCluster(1);
Path rootdir = TEST_UTIL.getDataTestDirOnTestFS("TestGenerateDelegationToken");
FSUtils.setRootDir(TEST_UTIL.getConfiguration(), rootdir);
CLUSTER = new LocalHBaseCluster(TEST_UTIL.getConfiguration(), 1);
CLUSTER.startup();
}
示例3: start
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private int start() throws Exception {
Configuration conf = getConf();
CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
try {
// If 'local', don't start a region server here. Defer to
// LocalHBaseCluster. It manages 'local' clusters.
if (LocalHBaseCluster.isLocal(conf)) {
LOG.warn("Not starting a distinct region server because "
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
} else {
logProcessInfo(getConf());
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf, cp);
hrs.start();
hrs.join();
if (hrs.isAborted()) {
throw new RuntimeException("HRegionServer Aborted");
}
}
} catch (Throwable t) {
LOG.error("Region server exiting", t);
return 1;
}
return 0;
}
示例4: start
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private int start() throws Exception {
Configuration conf = getConf();
try {
// If 'local', don't start a region server here. Defer to
// LocalHBaseCluster. It manages 'local' clusters.
if (LocalHBaseCluster.isLocal(conf)) {
LOG.warn("Not starting a distinct region server because "
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
} else {
logProcessInfo(getConf());
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf);
Thread rsThread = HRegionServer.startRegionServer(hrs);
rsThread.join();
if (hrs.isAborted()) {
throw new RuntimeException("HRegionServer Aborted");
}
}
} catch (Throwable t) {
LOG.error("Region server exiting", t);
return 1;
}
return 0;
}
示例5: start
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private int start() throws Exception {
Configuration conf = getConf();
TraceUtil.initTracer(conf);
try {
// If 'local', don't start a region server here. Defer to
// LocalHBaseCluster. It manages 'local' clusters.
if (LocalHBaseCluster.isLocal(conf)) {
LOG.warn("Not starting a distinct region server because "
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
} else {
logProcessInfo(getConf());
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf);
hrs.start();
hrs.join();
if (hrs.isAborted()) {
throw new RuntimeException("HRegionServer Aborted");
}
}
} catch (Throwable t) {
LOG.error("Region server exiting", t);
return 1;
}
return 0;
}
示例6: setUp
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
/**
* Setup and start kerberos, hbase
*/
@BeforeClass
public static void setUp() throws Exception {
KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
USERNAME = UserGroupInformation.getLoginUser().getShortUserName();
PRINCIPAL = USERNAME + "/" + HOST;
HTTP_PRINCIPAL = "HTTP/" + HOST;
KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL, HTTP_PRINCIPAL);
TEST_UTIL.startMiniZKCluster();
HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm());
HBaseKerberosUtils.setSecuredConfiguration(TEST_UTIL.getConfiguration());
setHdfsSecuredConfiguration(TEST_UTIL.getConfiguration());
UserGroupInformation.setConfiguration(TEST_UTIL.getConfiguration());
TEST_UTIL.getConfiguration().setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
TokenProvider.class.getName());
TEST_UTIL.startMiniDFSCluster(1);
Path rootdir = TEST_UTIL.getDataTestDirOnTestFS("TestGenerateDelegationToken");
FSUtils.setRootDir(TEST_UTIL.getConfiguration(), rootdir);
CLUSTER = new LocalHBaseCluster(TEST_UTIL.getConfiguration(), 1);
CLUSTER.startup();
}
示例7: waitOnMasterThreads
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{
List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();
if (masters != null) {
for (JVMClusterUtil.MasterThread t : masters) {
t.join();
if(t.getMaster().isAborted()) {
closeAllRegionServerThreads(regionservers);
throw new RuntimeException("HMaster Aborted");
}
}
}
}
示例8: setUp
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
testUtil = new HBaseTestingUtility();
testUtil.startMiniDFSCluster(1);
testUtil.startMiniZKCluster(1);
testUtil.createRootDir();
cluster = new LocalHBaseCluster(testUtil.getConfiguration(), 0, 0);
}
示例9: getInstanceConfig
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
public static synchronized Configuration getInstanceConfig() throws Exception {
if (conf == null) {
File zooRoot = File.createTempFile("hbase-zookeeper", "");
zooRoot.delete();
ZooKeeperServer zookeper = new ZooKeeperServer(zooRoot, zooRoot, 2000);
ServerCnxnFactory factory = ServerCnxnFactory.createFactory(new InetSocketAddress("localhost", 0), 5000);
factory.startup(zookeper);
YarnConfiguration yconf = new YarnConfiguration();
String argLine = System.getProperty("argLine");
if (argLine != null) {
yconf.set("yarn.app.mapreduce.am.command-opts", argLine.replace("jacoco.exec", "jacocoMR.exec"));
}
yconf.setBoolean(MRConfig.MAPREDUCE_MINICLUSTER_CONTROL_RESOURCE_MONITORING, false);
yconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class, ResourceScheduler.class);
MiniMRYarnCluster miniCluster = new MiniMRYarnCluster("testCluster");
miniCluster.init(yconf);
yconf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, true);
miniCluster.start();
File hbaseRoot = File.createTempFile("hbase-root", "");
hbaseRoot.delete();
conf = HBaseConfiguration.create(miniCluster.getConfig());
conf.set(HConstants.HBASE_DIR, hbaseRoot.toURI().toURL().toString());
conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, factory.getLocalPort());
conf.set("hbase.master.hostname", "localhost");
conf.set("hbase.regionserver.hostname", "localhost");
conf.setInt("hbase.master.info.port", -1);
conf.set("hbase.fs.tmp.dir", new File(System.getProperty("java.io.tmpdir")).toURI().toURL().toString());
LocalHBaseCluster cluster = new LocalHBaseCluster(conf);
cluster.startup();
}
return conf;
}
示例10: waitOnMasterThreads
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{
List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();
if (masters != null) {
for (JVMClusterUtil.MasterThread t : masters) {
t.join();
if(t.getMaster().isAborted()) {
closeAllRegionServerThreads(regionservers);
throw new RuntimeException("HMaster Aborted");
}
}
}
}
示例11: start
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private int start() throws Exception {
Configuration conf = getConf();
// If 'local', don't start a region server here. Defer to
// LocalHBaseCluster. It manages 'local' clusters.
if (LocalHBaseCluster.isLocal(conf)) {
LOG.warn("Not starting a distinct region server because "
+ HConstants.CLUSTER_DISTRIBUTED + " is false");
} else {
logJVMInfo();
HRegionServer hrs = HRegionServer.constructRegionServer(regionServerClass, conf);
HRegionServer.startRegionServer(hrs);
}
return 0;
}
示例12: startLocalCluster
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
public static void startLocalCluster() throws IOException, InterruptedException
{
startZooKeeperServer();
//Configuration conf = HBaseConfiguration.create();
Configuration conf = getConfiguration();
LocalHBaseCluster lc = new LocalHBaseCluster(conf);
lc.startup();
}
示例13: startCluster
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
public static void startCluster() throws Exception {
Configuration hbaseConf =
HBaseBasedAuditRepository.getHBaseConfiguration(ApplicationProperties.get());
hbaseTestUtility = HBaseTestingUtility.createLocalHTU(hbaseConf);
int zkPort = hbaseConf.getInt("hbase.zookeeper.property.clientPort", 19026);
hbaseTestUtility.startMiniZKCluster(1, zkPort);
hbaseCluster = new LocalHBaseCluster(hbaseTestUtility.getConfiguration());
hbaseCluster.startup();
}
示例14: waitOnMasterThreads
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException {
List<JVMClusterUtil.MasterThread> masters = cluster.getMasters();
List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers();
if (masters != null) {
for (JVMClusterUtil.MasterThread t : masters) {
t.join();
if (t.getMaster().isAborted()) {
closeAllRegionServerThreads(regionservers);
throw new RuntimeException("HMaster Aborted");
}
}
}
}
示例15: testMasterShutdownBeforeStartingAnyRegionServer
import org.apache.hadoop.hbase.LocalHBaseCluster; //导入依赖的package包/类
@Test(timeout = 60000)
public void testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
final int NUM_MASTERS = 1;
final int NUM_RS = 0;
// Create config to use for this cluster
Configuration conf = HBaseConfiguration.create();
conf.setInt("hbase.ipc.client.failed.servers.expiry", 200);
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
// Start the cluster
final HBaseTestingUtility util = new HBaseTestingUtility(conf);
util.startMiniDFSCluster(3);
util.startMiniZKCluster();
util.createRootDir();
final LocalHBaseCluster cluster =
new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
final int MASTER_INDEX = 0;
final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
master.start();
LOG.info("Called master start on " + master.getName());
Thread shutdownThread = new Thread() {
public void run() {
LOG.info("Before call to shutdown master");
try {
try (Connection connection =
ConnectionFactory.createConnection(util.getConfiguration())) {
try (Admin admin = connection.getAdmin()) {
admin.shutdown();
}
}
LOG.info("After call to shutdown master");
cluster.waitOnMaster(MASTER_INDEX);
} catch (Exception e) {
}
};
};
shutdownThread.start();
LOG.info("Called master join on " + master.getName());
master.join();
shutdownThread.join();
List<MasterThread> masterThreads = cluster.getMasters();
// make sure all the masters properly shutdown
assertEquals(0, masterThreads.size());
util.shutdownMiniZKCluster();
util.shutdownMiniDFSCluster();
util.cleanupTestDir();
}