• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClusterId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ClusterId类属于org.apache.hadoop.hbase.zookeeper包,在下文中一共展示了ClusterId类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: preRegistrationInitialization

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
/**
 * All initialization needed before we go register with Master.
 * @throws IOException
 * @throws InterruptedException
 */
private void preRegistrationInitialization() {
  try {
    initializeZooKeeper();

    clusterId = new ClusterId(zooKeeper, this);
    if (clusterId.hasId()) {
      conf.set(HConstants.CLUSTER_ID, clusterId.getId());
    }

    initializeThreads();
    int nbBlocks = conf.getInt("hbase.regionserver.nbreservationblocks", 4);
    for (int i = 0; i < nbBlocks; i++) {
      reservedSpace.add(new byte[HConstants.DEFAULT_SIZE_RESERVATION_BLOCK]);
    }

    this.rpcEngine = HBaseRPC.getProtocolEngine(conf);
  } catch (Throwable t) {
    // Call stop if error or process will stick around for ever since server
    // puts up non-daemon threads.
    this.rpcServer.stop();
    abort("Initialization of RS failed.  Hence aborting RS.", t);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:HRegionServer.java


示例2: preRegistrationInitialization

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
/**
 * All initialization needed before we go register with Master.
 *
 * @throws IOException
 * @throws InterruptedException
 */
private void preRegistrationInitialization(){
  try {
    initializeZooKeeper();

    clusterId = new ClusterId(zooKeeper, this);
    if(clusterId.hasId()) {
      conf.set(HConstants.CLUSTER_ID, clusterId.getId());
    }

    initializeThreads();
    int nbBlocks = conf.getInt("hbase.regionserver.nbreservationblocks", 4);
    for (int i = 0; i < nbBlocks; i++) {
      reservedSpace.add(new byte[HConstants.DEFAULT_SIZE_RESERVATION_BLOCK]);
    }

    this.rpcEngine = HBaseRPC.getProtocolEngine(conf);
  } catch (Throwable t) {
    // Call stop if error or process will stick around for ever since server
    // puts up non-daemon threads.
    this.rpcServer.stop();
    abort("Initialization of RS failed.  Hence aborting RS.", t);
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:30,代码来源:HRegionServer.java


示例3: getAuthToken

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的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<?> getAuthToken(Configuration conf, User user)
    throws IOException, InterruptedException {
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "mr-init-credentials", null);
  try {
    String clusterId = ClusterId.readClusterIdZNode(zkw);
    return user.getToken("HBASE_AUTH_TOKEN", clusterId);
  } catch (KeeperException e) {
    throw new IOException(e);
  } finally {
    zkw.close();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:TableMapReduceUtil.java


示例4: AuthenticationTokenSecretManager

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
/**
 * Create a new secret manager instance for generating keys.
 * @param conf Configuration to use
 * @param zk Connection to zookeeper for handling leader elections
 * @param keyUpdateInterval Time (in milliseconds) between rolling a new master key for token signing
 * @param tokenMaxLifetime Maximum age (in milliseconds) before a token expires and is no longer valid
 */
/* TODO: Restrict access to this constructor to make rogues instances more difficult.
 * For the moment this class is instantiated from
 * org.apache.hadoop.hbase.ipc.SecureServer so public access is needed.
 */
public AuthenticationTokenSecretManager(Configuration conf,
    ZooKeeperWatcher zk, String serverName,
    long keyUpdateInterval, long tokenMaxLifetime) {
  this.zkWatcher = new ZKSecretWatcher(conf, zk, this);
  this.keyUpdateInterval = keyUpdateInterval;
  this.tokenMaxLifetime = tokenMaxLifetime;
  this.leaderElector = new LeaderElector(zk, serverName);
  this.name = NAME_PREFIX+serverName;
  this.clusterId = new ClusterId(zk, zk);
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:22,代码来源:AuthenticationTokenSecretManager.java


示例5: setupZookeeperTrackers

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
private synchronized void setupZookeeperTrackers()
    throws ZooKeeperConnectionException{
  // initialize zookeeper and master address manager
  this.zooKeeper = getZooKeeperWatcher();
  masterAddressTracker = new MasterAddressTracker(this.zooKeeper, this);
  masterAddressTracker.start();

  this.rootRegionTracker = new RootRegionTracker(this.zooKeeper, this);
  this.rootRegionTracker.start();

  this.clusterId = new ClusterId(this.zooKeeper, this);
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:13,代码来源:HConnectionManager.java


示例6: init

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
/**
 * Instantiation method used by region servers
 *
 * @param conf configuration to use
 * @param fs file system to use
 * @param manager replication manager to ping to
 * @param stopper     the atomic boolean to use to stop the regionserver
 * @param replicating the atomic boolean that starts/stops replication
 * @param peerClusterZnode the name of our znode
 * @throws IOException
 */
public void init(final Configuration conf,
                 final FileSystem fs,
                 final ReplicationSourceManager manager,
                 final Stoppable stopper,
                 final AtomicBoolean replicating,
                 final String peerClusterZnode)
    throws IOException {
  this.stopper = stopper;
  this.conf = conf;
  this.replicationQueueSizeCapacity =
      this.conf.getLong("replication.source.size.capacity", 1024*1024*64);
  this.replicationQueueNbCapacity =
      this.conf.getInt("replication.source.nb.capacity", 25000);
  this.entriesArray = new HLog.Entry[this.replicationQueueNbCapacity];
  for (int i = 0; i < this.replicationQueueNbCapacity; i++) {
    this.entriesArray[i] = new HLog.Entry();
  }
  this.maxRetriesMultiplier =
      this.conf.getInt("replication.source.maxretriesmultiplier", 10);
  this.socketTimeoutMultiplier = maxRetriesMultiplier * maxRetriesMultiplier;
  this.queue =
      new PriorityBlockingQueue<Path>(
          conf.getInt("hbase.regionserver.maxlogs", 32),
          new LogsComparator());
  this.conn = HConnectionManager.getConnection(conf);
  this.zkHelper = manager.getRepZkWrapper();
  this.ratio = this.conf.getFloat("replication.source.ratio", 0.1f);
  this.currentPeers = new ArrayList<ServerName>();
  this.random = new Random();
  this.replicating = replicating;
  this.manager = manager;
  this.sleepForRetries =
      this.conf.getLong("replication.source.sleepforretries", 1000);
  this.fs = fs;
  this.metrics = new ReplicationSourceMetrics(peerClusterZnode);

  try {
    this.clusterId = UUID.fromString(ClusterId.readClusterIdZNode(zkHelper
        .getZookeeperWatcher()));
  } catch (KeeperException ke) {
    throw new IOException("Could not read cluster id", ke);
  }

  // Finally look if this is a recovered queue
  this.checkIfQueueRecovered(peerClusterZnode);
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:58,代码来源:ReplicationSource.java


示例7: getUUIDForCluster

import org.apache.hadoop.hbase.zookeeper.ClusterId; //导入依赖的package包/类
/**
 * Get the UUID for the provided ZK watcher. Doesn't handle any ZK exceptions
 * @param zkw watcher connected to an ensemble
 * @return the UUID read from zookeeper
 * @throws KeeperException
 */
public UUID getUUIDForCluster(ZooKeeperWatcher zkw) throws KeeperException {
  return UUID.fromString(ClusterId.readClusterIdZNode(zkw));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:ReplicationZookeeper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReversePathHierarchyTokenizer类代码示例发布时间:2022-05-23
下一篇:
Java Aspect类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap