Examples of HBaseAdmin


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

      return this.prefix+"_"+ tablename+"_queue";
    }

    public void create(String tablename, int shardcount, Map<?, ?> params) throws IOException{

      HBaseAdmin admin = new HBaseAdmin(config);
      String tablenameshard = this.getDataTableNme(tablename);
     
     
      if (!admin.tableExists(tablenameshard)) {
        HTableDescriptor tableDescripter = new HTableDescriptor(tablenameshard.getBytes());
        tableDescripter.setValue("group",String.valueOf(params.get("realtime.hbase.group")));

        HColumnDescriptor columnDescripter2 = new HColumnDescriptor(DATA_FAMILY);
        columnDescripter2.setBlockCacheEnabled(false);
        columnDescripter2.setBlocksize(262144);
        columnDescripter2.setBloomFilterType(BloomType.NONE);
        columnDescripter2.setCompressionType(Algorithm.GZ);
        columnDescripter2.setMaxVersions(10);
        columnDescripter2.setInMemory(false);
        columnDescripter2.setTimeToLive(Integer.MAX_VALUE);
        tableDescripter.addFamily(columnDescripter2);

        admin.createTable(tableDescripter);
      }
     
     
      String tablenamequeue = this.getQueueTableNme(tablename);
      if (!admin.tableExists(tablenamequeue)) {
        HTableDescriptor tableDescripter = new HTableDescriptor(tablenamequeue.getBytes());
        tableDescripter.setValue("group",String.valueOf(params.get("realtime.hbase.group")));

        HColumnDescriptor columnDescripter2 = new HColumnDescriptor(MdrillQueue.FAMILY);
        columnDescripter2.setBlockCacheEnabled(false);
        columnDescripter2.setBlocksize(262144);
        columnDescripter2.setBloomFilterType(BloomType.NONE);
        columnDescripter2.setCompressionType(Algorithm.NONE);
        columnDescripter2.setMaxVersions(10);
        columnDescripter2.setInMemory(false);
        columnDescripter2.setTimeToLive(2 * 24 * 60 * 60);
        tableDescripter.addFamily(columnDescripter2);
        admin.createTable(tableDescripter);
      }
       
   
    }
 
View Full Code Here

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

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

  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

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

    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

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

  /**
   * 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

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

   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

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

    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

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

  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

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

      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

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

  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
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.