Java 类org.apache.hadoop.hbase.zookeeper.ClusterId 实例源码

项目:LCIndex-HBase-0.94.16    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:IRIndex    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:HBase-Research    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:hbase-0.94.8-qod    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:hbase-0.94.8-qod    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:hindex    文件:HRegionServer.java   
/**
 * 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);
  }
}
项目:LCIndex-HBase-0.94.16    文件:TableMapReduceUtil.java   
/**
 * 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();
  }
}
项目:LCIndex-HBase-0.94.16    文件:TableMapReduceUtil.java   
/**
 * 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();
  }
}
项目:IRIndex    文件:AuthenticationTokenSecretManager.java   
/**
 * 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);
}
项目:IRIndex    文件:TableMapReduceUtil.java   
/**
 * 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();
  }
}
项目:IRIndex    文件:TableMapReduceUtil.java   
/**
 * 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();
  }
}
项目:RStore    文件:HConnectionManager.java   
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);
}
项目:HBase-Research    文件:AuthenticationTokenSecretManager.java   
/**
 * 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);
}
项目:hbase-0.94.8-qod    文件:AuthenticationTokenSecretManager.java   
/**
 * 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);
}
项目:hbase-0.94.8-qod    文件:AuthenticationTokenSecretManager.java   
/**
 * 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);
}
项目:hindex    文件:AuthenticationTokenSecretManager.java   
/**
 * 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);
}
项目:RStore    文件:ReplicationSource.java   
/**
 * 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);
}
项目:LCIndex-HBase-0.94.16    文件:ReplicationZookeeper.java   
/**
 * 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));
}
项目:IRIndex    文件:ReplicationZookeeper.java   
/**
 * 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));
}
项目:HBase-Research    文件:ReplicationZookeeper.java   
/**
 * 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));
}
项目:hbase-0.94.8-qod    文件:ReplicationZookeeper.java   
/**
 * 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));
}
项目:hbase-0.94.8-qod    文件:ReplicationZookeeper.java   
/**
 * 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));
}
项目:hindex    文件:ReplicationZookeeper.java   
/**
 * 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));
}