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


Java ZKClusterId.readClusterIdZNode方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.zookeeper.ZKClusterId.readClusterIdZNode方法的典型用法代码示例。如果您正苦于以下问题:Java ZKClusterId.readClusterIdZNode方法的具体用法?Java ZKClusterId.readClusterIdZNode怎么用?Java ZKClusterId.readClusterIdZNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.zookeeper.ZKClusterId的用法示例。


在下文中一共展示了ZKClusterId.readClusterIdZNode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testClusterId

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
@Test
public void testClusterId() throws Exception  {
  TEST_UTIL.startMiniZKCluster();
  TEST_UTIL.startMiniDFSCluster(1);

  Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
  CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
  //start region server, needs to be separate
  //so we get an unset clusterId
  rst = JVMClusterUtil.createRegionServerThread(conf,cp,
      HRegionServer.class, 0);
  rst.start();
  //Make sure RS is in blocking state
  Thread.sleep(10000);

  TEST_UTIL.startMiniHBaseCluster(1, 1);

  rst.waitForServerOnline();

  String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
  assertNotNull(clusterId);
  assertEquals(clusterId, rst.getRegionServer().getClusterId());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:TestClusterId.java

示例2: getAuthToken

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
/**
 * Get the authentication token of the user for the cluster specified in the configuration
 * @return null if the user does not have the token, otherwise the auth token for the cluster.
 */
private static Token<AuthenticationTokenIdentifier> getAuthToken(Configuration conf, User user)
    throws IOException, InterruptedException {
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "TokenUtil-getAuthToken", null);
  try {
    String clusterId = ZKClusterId.readClusterIdZNode(zkw);
    if (clusterId == null) {
      throw new IOException("Failed to get cluster ID");
    }
    return new AuthenticationTokenSelector().selectToken(new Text(clusterId), user.getTokens());
  } catch (KeeperException e) {
    throw new IOException(e);
  } finally {
    zkw.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TokenUtil.java

示例3: testClusterId

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
@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);

  TEST_UTIL.startMiniHBaseCluster(1, 0);

  rst.waitForServerOnline();

  String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
  assertNotNull(clusterId);
  assertEquals(clusterId, rst.getRegionServer().getClusterId());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:TestClusterId.java

示例4: getAuthToken

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
/**
 * Get the authentication token of the user for the cluster specified in the configuration
 * @return null if the user does not have the token, otherwise the auth token for the cluster.
 */
private static Token<AuthenticationTokenIdentifier> getAuthToken(Configuration conf, User user)
    throws IOException, InterruptedException {
  ZKWatcher zkw = new ZKWatcher(conf, "TokenUtil-getAuthToken", null);
  try {
    String clusterId = ZKClusterId.readClusterIdZNode(zkw);
    if (clusterId == null) {
      throw new IOException("Failed to get cluster ID");
    }
    return new AuthenticationTokenSelector().selectToken(new Text(clusterId), user.getTokens());
  } catch (KeeperException e) {
    throw new IOException(e);
  } finally {
    zkw.close();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TokenUtil.java

示例5: testClusterId

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
@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);

  TEST_UTIL.startMiniHBaseCluster(1, 0);

  rst.waitForServerOnline();

  String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
  assertNotNull(clusterId);
  assertEquals(clusterId, rst.getRegionServer().getClusterId());
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestClusterId.java

示例6: testClusterId

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
@Test
public void testClusterId() throws Exception  {
  TEST_UTIL.startMiniZKCluster();
  TEST_UTIL.startMiniDFSCluster(1);

  Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
  CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
  //start region server, needs to be separate
  //so we get an unset clusterId
  rst = JVMClusterUtil.createRegionServerThread(conf,cp,
      HRegionServer.class, 0);
  rst.start();
  //Make sure RS is in blocking state
  Thread.sleep(10000);

  TEST_UTIL.startMiniHBaseCluster(1, 0);

  rst.waitForServerOnline();

  String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
  assertNotNull(clusterId);
  assertEquals(clusterId, rst.getRegionServer().getClusterId());
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:24,代码来源:TestClusterId.java

示例7: testClusterId

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
@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);

  TEST_UTIL.startMiniHBaseCluster(1, 0);

  rst.waitForServerOnline();

  String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
  assertNotNull(clusterId);
  assertEquals(clusterId, rst.getRegionServer().getConfiguration().get(HConstants.CLUSTER_ID));
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:23,代码来源:TestClusterId.java

示例8: getAuthToken

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
/**
 * Get the authentication token of the user for the cluster specified in the configuration
 * @return null if the user does not have the token, otherwise the auth token for the cluster.
 */
private static Token<AuthenticationTokenIdentifier> getAuthToken(Configuration conf, User user)
    throws IOException, InterruptedException {
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "mr-init-credentials", null);
  try {
    String clusterId = ZKClusterId.readClusterIdZNode(zkw);
    return new AuthenticationTokenSelector().selectToken(new Text(clusterId), user.getUGI().getTokens());
  } catch (KeeperException e) {
    throw new IOException(e);
  } finally {
    zkw.close();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:TableMapReduceUtil.java

示例9: initializeZooKeeper

import org.apache.hadoop.hbase.zookeeper.ZKClusterId; //导入方法依赖的package包/类
/**
 * Bring up connection to zk ensemble and then wait until a master for this
 * cluster and then after that, wait until cluster 'up' flag has been set.
 * This is the order in which master does things.
 * Finally put up a catalog tracker.
 * @throws IOException
 * @throws InterruptedException
 */
private void initializeZooKeeper() throws IOException, InterruptedException {
  // Open connection to zookeeper and set primary watcher
  this.zooKeeper = new ZooKeeperWatcher(conf, REGIONSERVER + ":" +
    this.isa.getPort(), this);

  // Create the master address manager, register with zk, and start it.  Then
  // block until a master is available.  No point in starting up if no master
  // running.
  this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
  this.masterAddressManager.start();
  blockAndCheckIfStopped(this.masterAddressManager);

  // Wait on cluster being up.  Master will set this flag up in zookeeper
  // when ready.
  this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
  this.clusterStatusTracker.start();
  blockAndCheckIfStopped(this.clusterStatusTracker);

  // Create the catalog tracker and start it;
  this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf,
    this, this.conf.getInt("hbase.regionserver.catalog.timeout", 600000));
  catalogTracker.start();

  // Retrieve clusterId
  // Since cluster status is now up
  // ID should have already been set by HMaster
  try {
    String clusterId = ZKClusterId.readClusterIdZNode(this.zooKeeper);
    if (clusterId == null) {
      this.abort("Cluster ID has not been set");
    }
    this.conf.set(HConstants.CLUSTER_ID, clusterId);
    LOG.info("ClusterId : "+clusterId);
  } catch (KeeperException e) {
    this.abort("Failed to retrieve Cluster ID",e);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:46,代码来源:HRegionServer.java


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