當前位置: 首頁>>代碼示例>>Java>>正文


Java HBaseAdmin.execProcedure方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.HBaseAdmin.execProcedure方法的典型用法代碼示例。如果您正苦於以下問題:Java HBaseAdmin.execProcedure方法的具體用法?Java HBaseAdmin.execProcedure怎麽用?Java HBaseAdmin.execProcedure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.HBaseAdmin的用法示例。


在下文中一共展示了HBaseAdmin.execProcedure方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSimpleProcedureManager

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
@Test
public void testSimpleProcedureManager() throws IOException {
  HBaseAdmin admin = util.getHBaseAdmin();

  admin.execProcedure(SimpleMasterProcedureManager.SIMPLE_SIGNATURE,
      "mytest", new HashMap<String, String>());
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:8,代碼來源:TestProcedureManager.java

示例2: testFlushTableSnapshotWithProcedure

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test (timeout=300000)
public void testFlushTableSnapshotWithProcedure() throws Exception {
  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  // put some stuff in the table
  HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
  SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, TEST_FAM);

  // get the name of all the regionservers hosting the snapshotted table
  Set<String> snapshotServers = new HashSet<String>();
  List<RegionServerThread> servers = UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
  for (RegionServerThread server : servers) {
    if (server.getRegionServer().getOnlineRegions(TABLE_NAME).size() > 0) {
      snapshotServers.add(server.getRegionServer().getServerName().toString());
    }
  }

  LOG.debug("FS state before snapshot:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
      FSUtils.getRootDir(UTIL.getConfiguration()), LOG);

  // take a snapshot of the enabled table
  String snapshotString = "offlineTableSnapshot";
  byte[] snapshot = Bytes.toBytes(snapshotString);
  Map<String, String> props = new HashMap<String, String>();
  props.put("table", STRING_TABLE_NAME);
  admin.execProcedure(SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION,
      snapshotString, props);


  LOG.debug("Snapshot completed.");

  // make sure we have the snapshot
  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertOneSnapshotThatMatches(admin,
    snapshot, TABLE_NAME);

  // make sure its a valid snapshot
  FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
  Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
  LOG.debug("FS state after snapshot:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
      FSUtils.getRootDir(UTIL.getConfiguration()), LOG);

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, TEST_FAM, rootDir,
      admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:53,代碼來源:TestFlushSnapshotFromClient.java


注:本文中的org.apache.hadoop.hbase.client.HBaseAdmin.execProcedure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。