Examples of HServerAddress


Examples of org.apache.hadoop.hbase.HServerAddress

   */
  @Override
  @QosPriority(priority=HConstants.HIGH_QOS)
  public HServerInfo getHServerInfo() throws IOException {
    checkOpen();
    return new HServerInfo(new HServerAddress(this.isa),
      this.startcode, this.rsInfo.getInfoPort());
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

    @Override
    public void prewarmRegionCache(byte[] tableName,
        Map<HRegionInfo, HServerAddress> regions) {
      for (Map.Entry<HRegionInfo, HServerAddress> e : regions.entrySet()) {
        HServerAddress hsa = e.getValue();
        if (hsa == null || hsa.getInetSocketAddress() == null) continue;
        cacheLocation(tableName,
          new HRegionLocation(e.getKey(), hsa.getHostname(), hsa.getPort()));
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

    Map <HRegionInfo, ServerName> regionsMap = table.getRegionLocations();
    assertEquals(1, regionsMap.size());
    HRegionInfo regionInfo = regionsMap.keySet().iterator().next();
    ServerName addrBefore = regionsMap.get(regionInfo);
    // Verify region location before move.
    HServerAddress addrCache =
      table.getRegionLocation(regionInfo.getStartKey(), false).getServerAddress();
    HServerAddress addrNoCache =
      table.getRegionLocation(regionInfo.getStartKey(),
          true).getServerAddress();

    assertEquals(addrBefore.getPort(), addrCache.getPort());
    assertEquals(addrBefore.getPort(), addrNoCache.getPort());

    ServerName addrAfter = null;
    // Now move the region to a different server.
    for (int i = 0; i < SLAVES; i++) {
      HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(i);
      ServerName addr = regionServer.getServerName();
      if (addr.getPort() != addrBefore.getPort()) {
        admin.move(regionInfo.getEncodedNameAsBytes(),
            Bytes.toBytes(addr.toString()));
        // Wait for the region to move.
        Thread.sleep(5000);
        addrAfter = addr;
        break;
      }
    }

    // Verify the region was moved.
    addrCache =
      table.getRegionLocation(regionInfo.getStartKey(), false).getServerAddress();
    addrNoCache =
      table.getRegionLocation(regionInfo.getStartKey(),
          true).getServerAddress();
    assertNotNull(addrAfter);
    assertTrue(addrAfter.getPort() != addrCache.getPort());
    assertEquals(addrAfter.getPort(), addrNoCache.getPort());
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

      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

Examples of org.apache.hadoop.hbase.HServerAddress

   * Starts a HRegionServer at the default location
   * @param conf
   * @throws IOException
   */
  public HRegionServer(HBaseConfiguration conf) throws IOException {
    this(new HServerAddress(conf.get(REGIONSERVER_ADDRESS,
        DEFAULT_REGIONSERVER_ADDRESS)), conf);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

    String machineName = DNS.getDefaultHost(
        conf.get("hbase.regionserver.dns.interface","default"),
        conf.get("hbase.regionserver.dns.nameserver","default"));
    // Address is givin a default IP for the moment. Will be changed after
    // calling the master.
    this.serverInfo = new HServerInfo(new HServerAddress(
      new InetSocketAddress(address.getBindAddress(),
      this.server.getListenerAddress().getPort())), System.currentTimeMillis(),
      this.conf.getInt("hbase.regionserver.info.port", 60030), machineName);
   
    if (this.serverInfo.getServerAddress() == null) {
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

      long lastMsg = 0;
      // Now ask master what it wants us to do and tell it what we have done
      for (int tries = 0; !stopRequested.get() && isHealthy();) {
        // Try to get the root region location from the master.
        if (!haveRootRegion.get()) {
          HServerAddress rootServer = hbaseMaster.getRootRegionLocation();
          if (rootServer != null) {
            // By setting the root region location, we bypass the wait imposed on
            // HTable for all regions being assigned.
            this.connection.setRootRegionLocation(
                new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, rootServer));
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

        this.conf.set(key, value);
      }
      // Master may have sent us a new address with the other configs.
      // Update our address in this case. See HBASE-719
      if(conf.get("hbase.regionserver.address") != null)
        serverInfo.setServerAddress(new HServerAddress
            (conf.get("hbase.regionserver.address"),
            serverInfo.getServerAddress().getPort()));
      // Master sent us hbase.rootdir to use. Should be fully qualified
      // path with file system specification included.  Set 'fs.default.name'
      // to match the filesystem on hbase.rootdir else underlying hadoop hdfs
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

      try {
        // Do initial RPC setup.  The final argument indicates that the RPC
        // should retry indefinitely.
        master = (HMasterRegionInterface)HBaseRPC.waitForProxy(
            HMasterRegionInterface.class, HBaseRPCProtocolVersion.versionID,
            new HServerAddress(conf.get(MASTER_ADDRESS)).getInetSocketAddress(),
            this.conf, -1);
      } catch (IOException e) {
        LOG.warn("Unable to connect to master. Retrying. Error was:", e);
        sleeper.sleep();
      }
View Full Code Here

Examples of org.apache.hadoop.hbase.HServerAddress

   * @param conf
   * @throws IOException
   */
  public TransactionalRegionServer(final HBaseConfiguration conf)
      throws IOException {
    this(new HServerAddress(conf.get(REGIONSERVER_ADDRESS,
        DEFAULT_REGIONSERVER_ADDRESS)), conf);
  }
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.