Package org.apache.hadoop.hbase.zookeeper

Examples of org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper


      // Can we still be the master? If not, goodbye

      zooKeeperWrapper.close();
      try {
        zooKeeperWrapper = new ZooKeeperWrapper(conf, this);

        if(!writeAddressToZooKeeper(false)) {
          throw new Exception("Another Master is currently active");
        }
View Full Code Here


    HRegionServer rs = hbaseCluster.getRegionServer(index);
    expireSession(rs.getZooKeeperWrapper());
  }

  public void expireSession(ZooKeeperWrapper nodeZK) throws Exception{
    ZooKeeperWrapper zkw = new ZooKeeperWrapper(conf, EmptyWatcher.instance);
    String quorumServers = zkw.getQuorumServers();
    int sessionTimeout = 5 * 1000; // 5 seconds

    byte[] password = nodeZK.getSessionPassword();
    long sessionID = nodeZK.getSessionID();

View Full Code Here

     * Get this watcher's ZKW, instanciate it if necessary.
     * @return ZKW
     */
    public synchronized ZooKeeperWrapper getZooKeeperWrapper() throws IOException {
      if(zooKeeperWrapper == null) {
        zooKeeperWrapper = new ZooKeeperWrapper(conf, this);
      }
      return zooKeeperWrapper;
    }
View Full Code Here

      }
      this.rootRegionLocation = rootRegion;
    }
   
    public HMasterInterface getMaster() throws MasterNotRunningException {
      ZooKeeperWrapper zk = null;
      try {
        zk = getZooKeeperWrapper();
      } catch (IOException e) {
        throw new MasterNotRunningException(e);
      }

      HServerAddress masterLocation = null;
      synchronized (this.masterLock) {
        for (int tries = 0;
          !this.closed &&
          !this.masterChecked && this.master == null &&
          tries < numRetries;
        tries++) {

          try {
            masterLocation = zk.readMasterAddressOrThrow();

            HMasterInterface tryMaster = (HMasterInterface)HBaseRPC.getProxy(
                HMasterInterface.class, HBaseRPCProtocolVersion.versionID,
                masterLocation.getInetSocketAddress(), this.conf);
           
View Full Code Here

    private HRegionLocation locateRootRegion()
    throws IOException {

      // We lazily instantiate the ZooKeeper object because we don't want to
      // make the constructor have to throw IOException or handle it itself.
      ZooKeeperWrapper zk = getZooKeeperWrapper();

      HServerAddress rootRegionAddress = null;
      for (int tries = 0; tries < numRetries; tries++) {
        int localTimeouts = 0;
        // ask the master which server has the root region
        while (rootRegionAddress == null && localTimeouts < numRetries) {
          // Don't read root region until we're out of safe mode so we know
          // that the meta regions have been assigned.
          boolean outOfSafeMode = zk.checkOutOfSafeMode();
          if (outOfSafeMode) {
            rootRegionAddress = zk.readRootRegionLocation();
          }
          if (rootRegionAddress == null) {
            try {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Sleeping " + getPauseTime(tries) +
View Full Code Here

          isOfflined(regionInfo.getRegionNameAsString())) {
        LOG.warn("We opened a region while it was asked to be closed.");
      } else {
        master.getRegionManager().removeRegion(regionInfo);
      }
      ZooKeeperWrapper zkWrapper =
          ZooKeeperWrapper.getInstance(master.getConfiguration(),
              HMaster.class.getName());
      zkWrapper.deleteUnassignedRegion(regionInfo.getEncodedName());
      return true;
    }
  }
View Full Code Here

    HRegionServer rs = hbaseCluster.getRegionServer(index);
    expireSession(rs.getZooKeeperWrapper());
  }

  public void expireSession(ZooKeeperWrapper nodeZK) throws Exception{
    ZooKeeperWrapper zkw =
        ZooKeeperWrapper.createInstance(conf,
            ZooKeeperWrapper.class.getName());
    zkw.registerListener(EmptyWatcher.instance);
    String quorumServers = zkw.getQuorumServers();
    int sessionTimeout = 5 * 1000; // 5 seconds

    byte[] password = nodeZK.getSessionPassword();
    long sessionID = nodeZK.getSessionID();

View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.