当前位置: 首页>>代码示例>>Java>>正文


Java LocalHBaseCluster类代码示例

本文整理汇总了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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:HRegionServerCommandLine.java

示例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();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestGenerateDelegationToken.java

示例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;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:HRegionServerCommandLine.java

示例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;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:HRegionServerCommandLine.java

示例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;
}
 
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:HRegionServerCommandLine.java

示例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();
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:SecureTestCluster.java

示例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");
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:HMasterCommandLine.java

示例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);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:TestRegionServerReportForDuty.java

示例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;
}
 
开发者ID:Merck,项目名称:Halyard,代码行数:35,代码来源:HBaseServerTestInstance.java

示例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");
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:HMasterCommandLine.java

示例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;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:HRegionServerCommandLine.java

示例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();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:9,代码来源:HBaseTestHelper.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:11,代码来源:HBaseTestUtils.java

示例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");
            }
        }
    }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:15,代码来源:HMasterCommandLine.java

示例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();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:52,代码来源:TestMasterShutdown.java


注:本文中的org.apache.hadoop.hbase.LocalHBaseCluster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。