Package org.apache.hadoop.hbase.client

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


  conf.setInt("hfile.format.version", 3);
  UTIL.startMiniCluster(1);
  // Wait for the labels table to become available
  UTIL.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000);
  createLabels();
  Admin admin = new HBaseAdmin(UTIL.getConfiguration());
  HTableDescriptor tableDescriptor = new HTableDescriptor(
      TableName.valueOf(tableAname));
  for (HColumnDescriptor family : families) {
    tableDescriptor.addFamily(family);
  }
  admin.createTable(tableDescriptor);
  admin.close();
  setAuths();
}
View Full Code Here


  }

  @BeforeClass
  public static void beforeClass() throws Exception {
    UTIL.startMiniCluster();
    Admin admin = new HBaseAdmin(UTIL.getConfiguration());
    HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(tableAname));
    for (HColumnDescriptor family : families) {
      tableDescriptor.addFamily(family);
    }
    admin.createTable(tableDescriptor);
    admin.close();
  }
View Full Code Here

   */
  public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();
    LocalHBaseCluster cluster = new LocalHBaseCluster(conf);
    cluster.startup();
    Admin admin = new HBaseAdmin(conf);
    HTableDescriptor htd =
      new HTableDescriptor(TableName.valueOf(cluster.getClass().getName()));
    admin.createTable(htd);
    cluster.shutdown();
  }
View Full Code Here

  @Test
  public void testLoadAndVerify() throws Exception {
    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_NAME));
    htd.addFamily(new HColumnDescriptor(TEST_FAMILY));

    Admin admin = getTestingUtil(getConf()).getHBaseAdmin();
    admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), 40);

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

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

    // create HTableDescriptor for specified table
    TableName table = getTablename();
    HTableDescriptor htd = new HTableDescriptor(table);
    htd.addFamily(new HColumnDescriptor(TEST_FAMILY));

    Admin 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

        org.apache.hadoop.hbase.coprocessor.ColumnAggregationEndpoint.class.getName(),
        ProtobufCoprocessorService.class.getName());
    conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
        ProtobufCoprocessorService.class.getName());
    util.startMiniCluster(2);
    Admin admin = new HBaseAdmin(conf);
    HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
    desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
    admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
    util.waitUntilAllRegionsAssigned(TEST_TABLE);
    admin.close();

    Table table = new HTable(conf, TEST_TABLE);
    for (int i = 0; i < ROWSIZE; i++) {
      Put put = new Put(ROWS[i]);
      put.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(i));
View Full Code Here

    }
  }

  @Test
  public void testMasterCoprocessorService() throws Throwable {
    Admin admin = util.getHBaseAdmin();
    final TestProtos.EchoRequestProto request =
        TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
        TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
    assertEquals("hello", service.echo(null, request).getMessage());
  }
View Full Code Here

    LOG.info("Writing some data to the table");
    writeData(colsPerKey, recordSize, writeThreads, startKey, numKeys);

    // flush the table
    LOG.info("Flushing the table");
    Admin admin = util.getHBaseAdmin();
    admin.flush(getTablename());

    // re-open the regions to make sure that the replicas are up to date
    long refreshTime = conf.getLong(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 0);
    if (refreshTime > 0 && refreshTime <= 10000) {
      LOG.info("Sleeping " + refreshTime + "ms to ensure that the data is replicated");
      Threads.sleep(refreshTime);
    } else {
      LOG.info("Reopening the table");
      admin.disableTable(getTablename());
      admin.enableTable(getTablename());
    }

    // We should only start the ChaosMonkey after the readers are started and have cached
    // all of the region locations. Because the meta is not replicated, the timebounded reads
    // will timeout if meta server is killed.
View Full Code Here

    }
  }

  @Test
  public void testMasterCoprocessorError() throws Throwable {
    Admin admin = util.getHBaseAdmin();
    TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
        TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
    try {
      service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
      fail("Should have thrown an exception");
    } catch (ServiceException e) {
    }
View Full Code Here

      // Create three tables
      boolean acl = AccessControlClient.isAccessControllerRunning(getConf());
      if(!acl) {
        LOG.info("No ACL available.");
      }
      Admin admin = new HBaseAdmin(getConf());
      for (int i = 0; i < DEFAULT_TABLES_COUNT; i++) {
        TableName tableName = IntegrationTestBigLinkedListWithVisibility.getTableName(i);
        createTable(admin, tableName, false, acl);
      }
      TableName tableName = TableName.valueOf(COMMON_TABLE_NAME);
      createTable(admin, tableName, true, acl);
      admin.close();
    }
View Full Code Here

TOP

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

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.