Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HServerAddress


   * @param conf - Configuration object
   * @throws IOException
   */
  public HMaster(HBaseConfiguration conf) throws IOException {
    this(new Path(conf.get(HBASE_DIR)),
        new HServerAddress(conf.get(MASTER_ADDRESS, DEFAULT_MASTER_ADDRESS)),
        conf);
  }
View Full Code Here


    this.server = HbaseRPC.getServer(this, address.getBindAddress(),
        address.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
        false, conf);

    //  The rpc-server port can be ephemeral... ensure we have the correct info
    this.address = new HServerAddress(server.getListenerAddress());
    conf.set(MASTER_ADDRESS, address.toString());

    this.connection = HConnectionManager.getConnection(conf);

    this.metaRescanInterval =
View Full Code Here

  /**
   * @return Location of the <code>-ROOT-</code> region.
   */
  public HServerAddress getRootRegionLocation() {
    HServerAddress rootServer = null;
    if (!shutdownRequested && !closed.get()) {
      rootServer = regionManager.getRootRegionLocation();
    }
    return rootServer;
  }
View Full Code Here

  public MapWritable regionServerStartup(HServerInfo serverInfo)
  throws IOException {
    // Set the address for now even tho it will not be persisted on
    // the HRS side.
    String rsAddress = Server.getRemoteAddress();
    serverInfo.setServerAddress(new HServerAddress
        (rsAddress, serverInfo.getServerAddress().getPort()));
    // register with server manager
    serverManager.regionServerStartup(serverInfo);
    // send back some config info
    return createConfigurationSubset();
View Full Code Here

    HServerInfo storedInfo = serversToServerInfo.remove(s);
    if (storedInfo != null && !master.closed.get()) {
      // The startup message was from a known server with the same name.
      // Timeout the old one right away.
      HServerAddress root = master.getRootRegionLocation();
      if (root != null && root.equals(storedInfo.getServerAddress())) {
        master.regionManager.unassignRootRegion();
      }
      master.delayedToDoQueue.put(new ProcessServerShutdown(master, storedInfo));
    }
View Full Code Here

          Writables.getBytes(HRegionInfo.ROOT_REGIONINFO));
      r.commit(batchUpdate);
     
      batchUpdate = new BatchUpdate(ROW_KEY, System.currentTimeMillis());
      batchUpdate.put(HConstants.COL_SERVER,
        Bytes.toBytes(new HServerAddress(SERVER_ADDRESS).toString()));
      batchUpdate.put(HConstants.COL_STARTCODE, Bytes.toBytes(12345));
      batchUpdate.put(new Text(Bytes.toString(HConstants.COLUMN_FAMILY) +
        "region"), Bytes.toBytes("region"));
      r.commit(batchUpdate);
     
      // Verify that get works the same from memcache as when reading from disk
      // NOTE dumpRegion won't work here because it only reads from disk.
     
      verifyGet(r, SERVER_ADDRESS);
     
      // Close and re-open region, forcing updates to disk
     
      region.close();
      region = openClosedRegion(region);
      r = new HRegionIncommon(region);
     
      // Read it back
     
      verifyGet(r, SERVER_ADDRESS);
     
      // Update one family member and add a new one
     
      batchUpdate = new BatchUpdate(ROW_KEY, System.currentTimeMillis());
      batchUpdate.put(new Text(Bytes.toString(HConstants.COLUMN_FAMILY) +
        "region"),
        "region2".getBytes(HConstants.UTF8_ENCODING));
      String otherServerName = "bar.foo.com:4321";
      batchUpdate.put(HConstants.COL_SERVER,
        Bytes.toBytes(new HServerAddress(otherServerName).toString()));
      batchUpdate.put(new Text(Bytes.toString(HConstants.COLUMN_FAMILY) +
        "junk"),
        "junk".getBytes(HConstants.UTF8_ENCODING));
      r.commit(batchUpdate);
View Full Code Here

  throws IOException {
    boolean duplicateAssignment = false;
    if (!master.regionManager.isUnassigned(region)) {
      if (region.isRootRegion()) {
        // Root region
        HServerAddress rootServer = master.getRootRegionLocation();
        if (rootServer != null) {
          if (rootServer.toString().compareTo(serverName) == 0) {
            // A duplicate open report from the correct server
            return;
          }
          // We received an open report on the root region, but it is
          // assigned to a different server
View Full Code Here

    public void leaseExpired() {
      LOG.info(server + " lease expired");
      // Remove the server from the known servers list and update load info
      HServerInfo info = serversToServerInfo.remove(server);
      if (info != null) {
        HServerAddress root = master.getRootRegionLocation();
        if (root != null && root.equals(info.getServerAddress())) {
          master.regionManager.unassignRootRegion();
        }
        String serverName = info.getServerAddress().toString();
        HServerLoad load = serversToLoad.remove(serverName);
        if (load != null) {
View Full Code Here

      scan(false, null);
      getRegionInfo();
     
      // Store some new information
      HServerAddress address = new HServerAddress("foo.bar.com:1234");

      batchUpdate = new BatchUpdate(ROW_KEY, System.currentTimeMillis());

      batchUpdate.put(HConstants.COL_SERVER,  Bytes.toBytes(address.toString()));

      batchUpdate.put(HConstants.COL_STARTCODE, Bytes.toBytes(START_CODE));

      region.commit(batchUpdate);
     
      // Validate that we can still get the HRegionInfo, even though it is in
      // an older row on disk and there is a newer row in the memcache
     
      scan(true, address.toString());
      getRegionInfo();
     
      // flush cache

      region.flushcache();

      // Validate again
     
      scan(true, address.toString());
      getRegionInfo();

      // Close and reopen
     
      r.close();
      r = openClosedRegion(r);
      region = new HRegionIncommon(r);

      // Validate again
     
      scan(true, address.toString());
      getRegionInfo();

      // Now update the information again

      address = new HServerAddress("bar.foo.com:4321");
     
      batchUpdate = new BatchUpdate(ROW_KEY, System.currentTimeMillis());

      batchUpdate.put(HConstants.COL_SERVER,
        Bytes.toBytes(address.toString()));

      region.commit(batchUpdate);
     
      // Validate again
     
      scan(true, address.toString());
      getRegionInfo();

      // flush cache

      region.flushcache();

      // Validate again
     
      scan(true, address.toString());
      getRegionInfo();

      // Close and reopen
     
      r.close();
      r = openClosedRegion(r);
      region = new HRegionIncommon(r);

      // Validate again
     
      scan(true, address.toString());
      getRegionInfo();
     
      // clean up
     
      r.close();
View Full Code Here

      throw new IOException(e);
    }

    String addressString = Bytes.toString(data);
    LOG.debug("Read ZNode " + znode + " got " + addressString);
    HServerAddress address = new HServerAddress(addressString);
    return address;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HServerAddress

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.