Package org.apache.hadoop.hbase.client

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


      HTableDescriptor tableDesc = new HTableDescriptor(tableName);
      for (String family : families) {
        HColumnDescriptor columnDescriptor = new HColumnDescriptor(family);
        tableDesc.addFamily(columnDescriptor);
      }
      admin.createTable(tableDesc);
    } catch (Exception e) {
      e.printStackTrace();
      throw new IllegalStateException(e);
    }
View Full Code Here


    HTableDescriptor tableDesc = new HTableDescriptor(tableName);
    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("key")));
    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("familyone")));
    tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("familytwo")));

    hAdmin.createTable(tableDesc);
    boolean doesTableExist = hAdmin.tableExists(tableName);
    assertTrue(doesTableExist);

    hcatDriver.run("drop table mytabletwo");
    CommandProcessorResponse response = hcatDriver
View Full Code Here

  public void testAddColumn() throws IOException {
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    // Create a table with two families
    HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
    admin.createTable(baseHtd);
    admin.disableTable(TABLE_NAME);
    try {
      // Verify the table descriptor
      verifyTableDescriptor(TABLE_NAME, FAMILY_0);
View Full Code Here

    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    // Create a table with two families
    HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
    baseHtd.addFamily(new HColumnDescriptor(FAMILY_1));
    admin.createTable(baseHtd);
    admin.disableTable(TABLE_NAME);
    try {
      // Verify the table descriptor
      verifyTableDescriptor(TABLE_NAME, FAMILY_0, FAMILY_1);
View Full Code Here

    HTableDescriptor htd = new HTableDescriptor(TEST_NAME);
    htd.addFamily(new HColumnDescriptor(TEST_FAMILY));

    HBaseAdmin admin = getTestingUtil().getHBaseAdmin();
    int numPreCreate = 40;
    admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPreCreate);

    doLoad(getConf(), htd);
    doVerify(getConf(), htd);

    // Only disable and drop if we succeeded to verify - otherwise it's useful
View Full Code Here

    HTableDescriptor htd = new HTableDescriptor(table);
    htd.addFamily(new HColumnDescriptor(TEST_FAMILY));

    HBaseAdmin admin = new HBaseAdmin(getConf());
    if (doLoad) {
      admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPresplits);
      doLoad(getConf(), htd);
    }
    if (doVerify) {
      doVerify(getConf(), htd);
      if (doDelete) {
View Full Code Here

      HBaseAdmin admin = new HBaseAdmin(getConf());
      byte[] tableName = getTableName(getConf());
      if (!admin.tableExists(tableName)) {
        HTableDescriptor htd = new HTableDescriptor(getTableName(getConf()));
        htd.addFamily(new HColumnDescriptor(FAMILY_NAME));
        admin.createTable(htd);
      }
      admin.close();
    }

    public int runRandomInputGenerator(int numMappers, long numNodes, Path tmpOutput)
View Full Code Here

   
    HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
    // Create table then get the single region for our new table.
    HTableDescriptor htd = new HTableDescriptor(tableName);
    htd.addFamily(new HColumnDescriptor("cf"));
    admin.createTable(htd);

    List<HRegion> regions = null;
    for (int i=0; i<100; i++) {
      regions = cluster.getRegions(tableName);
      if (regions.size() > 0) break;
View Full Code Here

    final byte[] tableName = Bytes.toBytes("testShouldClearRITWhenNodeFoundInSplittingState");
    HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
    // Create table then get the single region for our new table.
    HTableDescriptor htd = new HTableDescriptor(tableName);
    htd.addFamily(new HColumnDescriptor("cf"));
    admin.createTable(htd);
    for (int i = 0; cluster.getRegions(tableName).size() == 0 && i < 100; i++) {
      Thread.sleep(100);
    }
    assertTrue("Table not online", cluster.getRegions(tableName).size() != 0);
View Full Code Here

    HBaseAdmin admin = new HBaseAdmin(conf);
    HTableDescriptor tableDesc = new HTableDescriptor(tableName);
    for (int i = 0; i < columns.length; i++) {
      tableDesc.addFamily(new HColumnDescriptor(columns[i]));
    }
    admin.createTable(tableDesc);

    // Insert values
   
    HTable table = new HTable(conf, getName());
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.