Package org.apache.hadoop.hbase.client

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


      int regionCountBeforeMerge = tbl.getRegionLocations().size();

      assertNotEquals(region1, region2);

      // do a region merge
      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
      admin.mergeRegions(region1.getEncodedNameAsBytes(),
          region2.getEncodedNameAsBytes(), false);

      // wait until region merged
      long timeout = System.currentTimeMillis() + 30 * 1000;
      while (true) {
View Full Code Here


        ScanLabelGenerator.class);
    util.startMiniCluster();
    // Wait for the labels table to become available
    util.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000);
    createLabels();
    HBaseAdmin admin = new HBaseAdmin(util.getConfiguration());
    util.startMiniMapReduceCluster();
  }
View Full Code Here

      //set global read so RegionServer can move it
      setPermission(loadPath, FsPermission.valueOf("-rwxrwxrwx"));

      HTable table = new HTable(conf, tableName);
      try {
        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
        TEST_UTIL.waitTableEnabled(admin, tableName.getName());
        LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);
        loader.doBulkLoad(loadPath, table);
      } finally {
        table.close();
View Full Code Here

  private void setupReplication() throws Exception {
    ReplicationAdmin admin1 = new ReplicationAdmin(conf1);
    ReplicationAdmin admin2 = new ReplicationAdmin(conf2);

    HBaseAdmin ha = new HBaseAdmin(conf1);
    ha.createTable(t1_syncupSource);
    ha.createTable(t2_syncupSource);
    ha.close();

    ha = new HBaseAdmin(conf2);
    ha.createTable(t1_syncupTarget);
    ha.createTable(t2_syncupTarget);
    ha.close();

    // Get HTable from Master
    ht1Source = new HTable(conf1, t1_su);
    ht1Source.setWriteBufferSize(1024);
    ht2Source = new HTable(conf1, t2_su);
View Full Code Here

  }

  protected HBaseAdmin getHBaseAdmin(JobConf conf) throws MasterNotRunningException, ZooKeeperConnectionException {
    if (hBaseAdmin == null) {
      Configuration hbaseConf = HBaseConfiguration.create(conf);
      hBaseAdmin = new HBaseAdmin(hbaseConf);
    }

    return hBaseAdmin;
  }
View Full Code Here

    return hBaseCollector;
  }

  @Override
  public boolean createResource(JobConf jobConf) throws IOException {
    HBaseAdmin hBaseAdmin = getHBaseAdmin(jobConf);

    if (hBaseAdmin.tableExists(tableName)) {
      return true;
    }

    LOG.info("creating hbase table: {}", tableName);

    HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);

    String[] familyNames = ((HBaseScheme) getScheme()).getFamilyNames();

    for (String familyName : familyNames) {
      tableDescriptor.addFamily(new HColumnDescriptor(familyName));
    }

    hBaseAdmin.createTable(tableDescriptor);

    return true;
  }
View Full Code Here

   }
  
   public void CreateTable() throws IOException, ZooKeeperConnectionException{
     Configuration conf = HBaseConfiguration.create();
     
     HBaseAdmin hbase = new HBaseAdmin(conf);
     HTableDescriptor[] wordcounts = hbase.listTables("wordcount");
     
     if(wordcounts.length != 0){ //Drop Table if Exists
        hbase.disableTable(TABLE_NAME);
       hbase.deleteTable(TABLE_NAME);
     }
    
     HTableDescriptor wordcount = new HTableDescriptor(TABLE_NAME);
     hbase.createTable(wordcount);
     // Cannot edit a stucture on an active table.
     hbase.disableTable(TABLE_NAME);
     HColumnDescriptor columnFamily = new HColumnDescriptor(COLUMN_FAMILY);
     hbase.addColumn(TABLE_NAME, columnFamily);
     hbase.enableTable(TABLE_NAME);
    
     hbase.close();
   }
View Full Code Here

    classes.add(clazz);
  }
 
  public void updateSchema() throws IOException {
    Configuration config = HBaseConfiguration.create();
    HBaseAdmin admin = new HBaseAdmin(config);
    HTableDescriptor[] descriptors = admin.listTables();
   
    List<String> tables = new ArrayList<String>();
   
    for (HTableDescriptor hTableDescriptor : descriptors) {
      tables.add(hTableDescriptor.getNameAsString());
    }
   
    for (Class<?> clazz : classes) {
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      String tableName = info.tableName;
     
      if(!tables.contains(tableName)) {
        // create table
        HTableDescriptor descriptor = createTable(tableName);
        admin.createTable(descriptor);
      }
      tables.remove(tableName);
    }
   
    for (String table : tables) {
      admin.disableTable(table);
      admin.deleteTable(table);
    }
  }
View Full Code Here

  }
 
  public void dropTables() {
    HBaseConfiguration config = new HBaseConfiguration();
    try {
      HBaseAdmin admin = new HBaseAdmin(config);
      HTableDescriptor[] descriptors = admin.listTables();
      for (HTableDescriptor hTableDescriptor : descriptors) {
        String name = hTableDescriptor.getNameAsString();
        admin.disableTable(name);
        admin.deleteTable(name);
      }
    } catch(IOException e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

      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

TOP

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

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.