Examples of ZooKeeperWrapper


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

  public void testRegionServerSessionExpired() {
    try {
      this.conf.setBoolean("hbase.regionserver.restart.on.zk.expire", true);
      new HTable(conf, HConstants.META_TABLE_NAME);
 
      ZooKeeperWrapper zkw = new ZooKeeperWrapper(conf, EmptyWatcher.instance);
      String quorumServers = zkw.getQuorumServers();
      int sessionTimeout = conf.getInt("zookeeper.session.timeout", 2 * 1000);

      HRegionServer rs = cluster.getRegionServer(0);
      ZooKeeperWrapper rsZK = rs.getZooKeeperWrapper();
      long sessionID = rsZK.getSessionID();
      byte[] password = rsZK.getSessionPassword();
 
      ZooKeeper zk = new ZooKeeper(quorumServers, sessionTimeout, EmptyWatcher.instance, sessionID, password);
      zk.close();

      Thread.sleep(sessionTimeout * 3);
 
View Full Code Here

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

      reservedSpace.add(new byte[DEFAULT_SIZE_RESERVATION_BLOCK]);
    }
  }

  private void reinitializeZooKeeper() throws IOException {
    zooKeeperWrapper = new ZooKeeperWrapper(conf, this);
    watchMasterAddress();
  }
View Full Code Here

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

      }
      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

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

    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

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

    this.metaRescanInterval =
      conf.getInt("hbase.master.meta.thread.rescanfrequency", 60 * 1000);

    this.sleeper = new Sleeper(this.threadWakeFrequency, this.closed);
   
    zooKeeperWrapper = new ZooKeeperWrapper(conf, this);
    zkMasterAddressWatcher = new ZKMasterAddressWatcher(this);
    serverManager = new ServerManager(this);
    regionManager = new RegionManager(this);
   
    writeAddressToZooKeeper(true);
View Full Code Here

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

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

     * 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

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

  HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
  Configuration conf = master.getConfiguration();
  HBaseAdmin hbadmin = new HBaseAdmin(conf);
  HConnection connection = hbadmin.getConnection();
  ZooKeeperWrapper wrapper = connection.getZooKeeperWrapper();

      out.write("\n\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n<title>ZooKeeper Dump</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hbase.css\" />\n</head>\n<body>\n<a id=\"logo\" href=\"http://hbase.org\"><img src=\"/static/hbase_logo_med.gif\" alt=\"HBase Logo\" title=\"HBase Logo\" /></a>\n<h1 id=\"page_title\">ZooKeeper Dump</h1>\n<p id=\"links_menu\"><a href=\"/master.jsp\">Master</a>, <a href=\"/logs/\">Local logs</a>, <a href=\"/stacks\">Thread Dump</a>, <a href=\"/logLevel\">Log Level</a></p>\n<hr id=\"head_rule\" />\n<pre>\n");
      out.print( wrapper.dump() );
      out.write("\n</pre>\n\n</body>\n</html>\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
View Full Code Here

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

      }
      this.rootRegionLocation = rootRegion;
    }

    public HMasterInterface getMaster() throws MasterNotRunningException {
      ZooKeeperWrapper zk;
      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

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

    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.
          rootRegionAddress = zk.readRootRegionLocation();
          if (rootRegionAddress == null) {
            try {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Sleeping " + getPauseTime(tries) +
                  "ms, waiting for root region.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.