Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.move()


      final Map.Entry<HRegionInfo, ServerName> firstRegion = regions.entrySet()
          .iterator().next();

      PrivilegedExceptionAction moveAction = new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          admin.move(firstRegion.getKey().getEncodedNameAsBytes(),
              Bytes.toBytes(newRs.getServerName().getServerName()));
          return null;
        }
      };
      SUPERUSER.runAs(moveAction);
View Full Code Here


      final Map.Entry<HRegionInfo, ServerName> firstRegion = regions.entrySet()
          .iterator().next();

      PrivilegedExceptionAction moveAction = new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          admin.move(firstRegion.getKey().getEncodedNameAsBytes(),
              Bytes.toBytes(newRs.getServerName().getServerName()));
          return null;
        }
      };
      SUPERUSER.runAs(moveAction);
View Full Code Here

    LOG.info("Moving " + victimRegions.size() + " regions from " + fromServers.size()
        + " servers to " + toServers.size() + " different servers");
    HBaseAdmin admin = this.context.getHaseIntegrationTestingUtility().getHBaseAdmin();
    for (byte[] victimRegion : victimRegions) {
      int targetIx = RandomUtils.nextInt(toServers.size());
      admin.move(victimRegion, Bytes.toBytes(toServers.get(targetIx).getServerName()));
    }
  }

  protected void forceBalancer() throws Exception {
    HBaseAdmin admin = this.context.getHaseIntegrationTestingUtility().getHBaseAdmin();
View Full Code Here

    for (HRegionInfo regionInfo:regions) {
      try {
        String destServerName =
          servers[RandomUtils.nextInt(servers.length)].getServerName();
        LOG.debug("Moving " + regionInfo.getRegionNameAsString() + " to " + destServerName);
        admin.move(regionInfo.getEncodedNameAsBytes(), Bytes.toBytes(destServerName));
      } catch (Exception e) {
        LOG.debug("Error moving region", e);
      }
      if (sleepTime > 0) {
        Thread.sleep(sleepTime);
View Full Code Here

      LOG.info("Moving " + victimRegions.size() + " regions from " + victimServers.size()
          + " servers to " + targetServers.size() + " different servers");
      HBaseAdmin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
      for (byte[] victimRegion : victimRegions) {
        int targetIx = random.nextInt(targetServers.size());
        admin.move(victimRegion, targetServers.get(targetIx));
      }
    }
  }

  public static class ForceBalancerAction extends Action {
View Full Code Here

        Random random = new Random();
        for (HRegionInfo regionInfo:regions) {
          try {
            byte[] destServerName =
              Bytes.toBytes(servers[random.nextInt(servers.length)].getServerName());
            admin.move(regionInfo.getRegionName(), destServerName);
          } catch (Exception e) {
            LOG.debug("Error moving region", e);
          }
        }
        Thread.sleep(sleepTime);
View Full Code Here

          .iterator().next();

      AccessTestAction moveAction = new AccessTestAction() {
        @Override
        public Object run() throws Exception {
          admin.move(firstRegion.getKey().getEncodedNameAsBytes(),
              Bytes.toBytes(newRs.getServerName().getServerName()));
          return null;
        }
      };
      SUPERUSER.runAs(moveAction);
View Full Code Here

        && !destServerName.equals(serverName));

      TEST_UTIL.deleteTable(table);

      try {
        admin.move(hri.getEncodedNameAsBytes(),
          Bytes.toBytes(destServerName.getServerName()));
        fail("We should not find the region");
      } catch (IOException ioe) {
        assertTrue(ioe instanceof UnknownRegionException);
      }
View Full Code Here

      do {
        Thread.sleep(10);
      } while (!originServer.getServerName().equals(
              cluster.getMaster().getAssignmentManager().getRegionServerOfRegion(regionInfo)));

      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
          Bytes.toBytes(targetServer.getServerName().getServerName()));

      do {
        Thread.sleep(10);
      } while (cluster.getServerWith(regionInfo.getRegionName()) == originServerNum ||
View Full Code Here

      // Put data: r2->v2
      putDataAndVerify(table, "r2", FAMILY, "v2", 2);

      // Move region to origin server
      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
          Bytes.toBytes(originServer.getServerName().getServerName()));
      do {
        Thread.sleep(1);
      } while (cluster.getServerWith(regionInfo.getRegionName()) == targetServerNum);
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.