Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HBaseAdmin


      this(HBaseConfiguration.create());
    }

    protected HBaseHandler(final Configuration c) throws IOException {
      this.conf = c;
      admin = new HBaseAdmin(conf);
      scannerMap = new HashMap<Integer, ResultScanner>();
      this.coalescer = new IncrementCoalescer(this);
    }
View Full Code Here


  public static String NAME = "completebulkload";

  public LoadIncrementalHFiles(Configuration conf) throws Exception {
    super(conf);
    this.cfg = conf;
    this.hbAdmin = new HBaseAdmin(conf);
  }
View Full Code Here

    HTable table = new HTable(conf, TEST_TABLE);
    table.put(new Put(Bytes.toBytes("row1"))
        .add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v1")));
    table.put(new Put(Bytes.toBytes("row2"))
        .add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v2")));
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    admin.split(TEST_TABLE);

    // wait for split
    Thread.sleep(10000);

    ListMultimap<String,TablePermission> postperms =
View Full Code Here

  /**
   * To repair region consistency, one must call connect() in order to repair
   * online state.
   */
  public void connect() throws IOException {
    admin = new HBaseAdmin(conf);
    meta = new HTable(conf, HConstants.META_TABLE_NAME);
    status = admin.getMaster().getClusterStatus();
    connection = admin.getConnection();
  }
View Full Code Here

   HTableDescriptor[] getHTableDescriptors(List<String> tableNames) {
    HTableDescriptor[] htd = new HTableDescriptor[0];
     try {
       LOG.info("getHTableDescriptors == tableNames => " + tableNames);
       htd = new HBaseAdmin(conf).getTableDescriptors(tableNames);
     } catch (IOException e) {
       LOG.debug("Exception getting table descriptors", e);
     }
     return htd;
  }
View Full Code Here

    if (!servlet.userRequestLimit(user, 1)) {
      return Response.status(509).build();
    }
    servlet.getMetrics().incrementRequests(1);
    try {
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      boolean success = false;
      for (int i = 0; i < 10; i++) try {
        admin.disableTable(actualTableName);
        success = true;
        break;
      } catch (IOException e) {
      }
      if (!success) {
        throw new IOException("could not disable table");
      }
      admin.deleteTable(actualTableName);
      return Response.ok().build();
    } catch (TableNotFoundException e) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    } catch (IOException e) {
      throw new WebApplicationException(e,
View Full Code Here

  public Response get(final @Context UriInfo uriInfo) throws IOException {
    if (!servlet.userRequestLimit(user, 1)) {
      Response.status(509).build();
    }
    try {
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      if (!admin.tableExists(actualTableName)) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
      }
    } catch (IOException e) {
      throw new WebApplicationException(Response.Status.SERVICE_UNAVAILABLE);
    }
View Full Code Here

      LOG.debug("GET " + uriInfo.getAbsolutePath());
    }
    servlet.getMetrics().incrementRequests(1);
    HBaseConfiguration conf = servlet.getConfiguration();
    try {
      HBaseAdmin admin = new HBaseAdmin(conf);
      StorageClusterVersionModel model = new StorageClusterVersionModel();
      model.setVersion(admin.getClusterStatus().getHBaseVersion());
      ResponseBuilder response = Response.ok(model);
      response.cacheControl(cacheControl);
      return response.build();
    } catch (IOException e) {
      throw new WebApplicationException(e,
View Full Code Here

  private Response update(final TableSchemaModel model, final boolean replace,
      final UriInfo uriInfo) {
    try {
      servlet.invalidateMaxAge(tableName);
      byte[] tableName = Bytes.toBytes(actualTableName);
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      if (replace || !admin.tableExists(tableName)) {
        return replace(tableName, model, uriInfo, admin);
      } else {
        return update(tableName, model, uriInfo, admin);
      }
    } catch (IOException e) {
View Full Code Here

  HTableAuthenticator authenticator;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    HBaseAdmin admin = new HBaseAdmin(conf);
    if (!admin.tableExists(TABLE)) {
      HTableDescriptor htd = new HTableDescriptor(TABLE);
      htd.addFamily(new HColumnDescriptor(USER));
      admin.createTable(htd);
      HTable table = new HTable(conf, TABLE);
      Put put = new Put(Bytes.toBytes(ADMIN_TOKEN));
      put.add(USER, NAME, Bytes.toBytes(ADMIN_USERNAME));
      put.add(USER, ADMIN, Bytes.toBytes(true));
      table.put(put);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.HBaseAdmin

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.