org.apache.hadoop.hbase.client.HBaseAdmin Java Examples
The following examples show how to use
org.apache.hadoop.hbase.client.HBaseAdmin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HBaseMiniCluster.java From yuzhouwan with Apache License 2.0 | 6 votes |
private HBaseTestingUtility hbaseOperation() throws Exception { HBaseTestingUtility hbaseTestingUtility = new HBaseTestingUtility(); /** * # fsOwner's name is Benedict Jin, will throw exception: Illegal character in path at index 42 * hbaseTestingUtility.getTestFileSystem().setOwner(new Path(BASE_PATH.concat("/owner")), "Benedict Jin", "supergroup"); */ MiniHBaseCluster hbaseCluster = hbaseTestingUtility.startMiniCluster(); hbaseTestingUtility.createTable(Bytes.toBytes(TABLE_NAME), Bytes.toBytes("context")); hbaseTestingUtility.deleteTable(Bytes.toBytes(TABLE_NAME)); Configuration config = hbaseCluster.getConf(); Connection conn = ConnectionFactory.createConnection(config); HBaseAdmin hbaseAdmin = new HBaseAdmin(conn); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(TABLE_NAME)); hbaseAdmin.createTable(desc); return hbaseTestingUtility; }
Example #2
Source File: AlterTableIT.java From phoenix with Apache License 2.0 | 6 votes |
@Test public void testSetHColumnProperties() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); String ddl = "CREATE TABLE T1 (\n" +"ID1 VARCHAR(15) NOT NULL,\n" +"ID2 VARCHAR(15) NOT NULL,\n" +"CREATED_DATE DATE,\n" +"CREATION_TIME BIGINT,\n" +"LAST_USED DATE,\n" +"CONSTRAINT PK PRIMARY KEY (ID1, ID2)) SALT_BUCKETS = 8"; Connection conn1 = DriverManager.getConnection(getUrl(), props); conn1.createStatement().execute(ddl); ddl = "ALTER TABLE T1 SET REPLICATION_SCOPE=1"; conn1.createStatement().execute(ddl); try (HBaseAdmin admin = conn1.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { HColumnDescriptor[] columnFamilies = admin.getTableDescriptor(Bytes.toBytes("T1")).getColumnFamilies(); assertEquals(1, columnFamilies.length); assertEquals("0", columnFamilies[0].getNameAsString()); assertEquals(1, columnFamilies[0].getScope()); } }
Example #3
Source File: StorageCleanUtil.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
/** * this method will close hbaseAdmin after finishing the work. */ public static void dropHTables(final HBaseAdmin hbaseAdmin, List<String> hTables) { runSingleThreadTaskQuietly(() -> { try { for (String htable : hTables) { logger.info("Deleting HBase table {}", htable); if (hbaseAdmin.tableExists(htable)) { if (hbaseAdmin.isTableEnabled(htable)) { hbaseAdmin.disableTable(htable); } hbaseAdmin.deleteTable(htable); logger.info("Deleted HBase table {}", htable); } else { logger.info("HBase table {} does not exist.", htable); } } } catch (Exception e) { // storage cleanup job will delete it logger.error("Deleting HBase table failed"); } finally { IOUtils.closeQuietly(hbaseAdmin); } }); }
Example #4
Source File: NativeHBaseTypesIT.java From phoenix with Apache License 2.0 | 6 votes |
@BeforeClass public static void doBeforeTestSetup() throws Exception { HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); try { try { admin.disableTable(HBASE_NATIVE_BYTES); admin.deleteTable(HBASE_NATIVE_BYTES); } catch (org.apache.hadoop.hbase.TableNotFoundException e) { } @SuppressWarnings("deprecation") HTableDescriptor descriptor = new HTableDescriptor(HBASE_NATIVE_BYTES); HColumnDescriptor columnDescriptor = new HColumnDescriptor(FAMILY_NAME); columnDescriptor.setKeepDeletedCells(true); descriptor.addFamily(columnDescriptor); admin.createTable(descriptor, SPLITS); initTableValues(); } finally { admin.close(); } }
Example #5
Source File: ExportKeys.java From hbase-tools with Apache License 2.0 | 6 votes |
public ExportKeys(HBaseAdmin admin, Args args) { this.admin = admin; this.args = args; if (args.getTableName().equals(Args.ALL_TABLES)) throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); if (args.getOptionSet().nonOptionArguments().size() != 3) throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); outputFileName = (String) args.getOptionSet().nonOptionArguments().get(2); if (args.has(Args.OPTION_OPTIMIZE)) { exportThreshold = parseExportThreshold(); System.out.println("exporting threshold: " + exportThreshold + " MB"); } else { exportThreshold = 0; System.out.println("exporting threshold is not set"); } }
Example #6
Source File: DeployCoprocessorCLI.java From Kylin with Apache License 2.0 | 6 votes |
public static void resetCoprocessor(String tableName, HBaseAdmin hbaseAdmin, Path hdfsCoprocessorJar) throws IOException { logger.info("Disable " + tableName); hbaseAdmin.disableTable(tableName); logger.info("Unset coprocessor on " + tableName); HTableDescriptor desc = hbaseAdmin.getTableDescriptor(TableName.valueOf(tableName)); while (desc.hasCoprocessor(OBSERVER_CLS_NAME)) { desc.removeCoprocessor(OBSERVER_CLS_NAME); } while (desc.hasCoprocessor(ENDPOINT_CLS_NAMAE)) { desc.removeCoprocessor(ENDPOINT_CLS_NAMAE); } addCoprocessorOnHTable(desc, hdfsCoprocessorJar); hbaseAdmin.modifyTable(tableName, desc); logger.info("Enable " + tableName); hbaseAdmin.enableTable(tableName); }
Example #7
Source File: Util.java From hbase-tools with Apache License 2.0 | 6 votes |
public static boolean isMoved(HBaseAdmin admin, String tableName, String regionName, String serverNameTarget) { try (HTable table = new HTable(admin.getConfiguration(), tableName)) { NavigableMap<HRegionInfo, ServerName> regionLocations = table.getRegionLocations(); for (Map.Entry<HRegionInfo, ServerName> regionLocation : regionLocations.entrySet()) { if (regionLocation.getKey().getEncodedName().equals(regionName)) { return regionLocation.getValue().getServerName().equals(serverNameTarget); } } if (!existsRegion(regionName, regionLocations.keySet())) return true; // skip moving } catch (IOException e) { return false; } return false; }
Example #8
Source File: TestEndToEndScenariosWithHA.java From phoenix-omid with Apache License 2.0 | 6 votes |
@AfterMethod(alwaysRun = true, timeOut = 60_000) public void cleanup() throws Exception { LOG.info("Cleanup"); HBaseAdmin admin = hBaseUtils.getHBaseAdmin(); deleteTable(admin, TableName.valueOf(DEFAULT_TIMESTAMP_STORAGE_TABLE_NAME)); hBaseUtils.createTable(TableName.valueOf((DEFAULT_TIMESTAMP_STORAGE_TABLE_NAME)), new byte[][]{DEFAULT_TIMESTAMP_STORAGE_CF_NAME.getBytes()}, Integer.MAX_VALUE); tso1.stopAndWait(); TestUtils.waitForSocketNotListening("localhost", TSO1_PORT, 100); tso2.stopAndWait(); TestUtils.waitForSocketNotListening("localhost", TSO2_PORT, 100); zkClient.delete().forPath(TSO_LEASE_PATH); LOG.info("ZKPath {} deleted", TSO_LEASE_PATH); zkClient.delete().forPath(CURRENT_TSO_PATH); LOG.info("ZKPaths {} deleted", CURRENT_TSO_PATH); zkClient.close(); }
Example #9
Source File: HbaseTestUtil.java From kafka-connect-hbase with Apache License 2.0 | 6 votes |
/** * Creates the table with the column families * * @param tableName * @param columnFamilies * @return */ public static void createTable(String tableName, String... columnFamilies) { HBaseTestingUtility testingUtility = getUtility(); if (!status.get()) { throw new RuntimeException("The mini cluster hasn't started yet. " + " Call HBaseTestUtil#startMiniCluster() before creating a table"); } final TableName name = TableName.valueOf(tableName); try (HBaseAdmin hBaseAdmin = testingUtility.getHBaseAdmin()) { final HTableDescriptor hTableDescriptor = new HTableDescriptor(name); for (String family : columnFamilies) { final HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(Bytes.toBytes(family)); hTableDescriptor.addFamily(hColumnDescriptor); } hBaseAdmin.createTable(hTableDescriptor); testingUtility.waitUntilAllRegionsAssigned(name); } catch (IOException e) { throw new RuntimeException(e); } }
Example #10
Source File: BaseTest.java From phoenix with Apache License 2.0 | 6 votes |
/** * Disable and drop all the tables except SYSTEM.CATALOG and SYSTEM.SEQUENCE */ private static void disableAndDropNonSystemTables() throws Exception { HBaseAdmin admin = driver.getConnectionQueryServices(null, null).getAdmin(); try { HTableDescriptor[] tables = admin.listTables(); for (HTableDescriptor table : tables) { String schemaName = SchemaUtil.getSchemaNameFromFullName(table.getName()); if (!QueryConstants.SYSTEM_SCHEMA_NAME.equals(schemaName)) { admin.disableTable(table.getName()); admin.deleteTable(table.getName()); } } } finally { admin.close(); } }
Example #11
Source File: BaseStatsCollectorIT.java From phoenix with Apache License 2.0 | 6 votes |
private void runUpdateStatisticsTool(String fullTableName) { UpdateStatisticsTool tool = new UpdateStatisticsTool(); tool.setConf(utility.getConfiguration()); String randomDir = getUtility().getRandomDir().toString(); final String[] cmdArgs = getArgValues(fullTableName, randomDir); try { int status = tool.run(cmdArgs); assertEquals("MR Job should complete successfully", 0, status); HBaseAdmin hBaseAdmin = utility.getHBaseAdmin(); assertEquals("Snapshot should be automatically deleted when UpdateStatisticsTool has completed", 0, hBaseAdmin.listSnapshots(tool.getSnapshotName()).size()); } catch (Exception e) { fail("Exception when running UpdateStatisticsTool for " + tableName + " Exception: " + e); } finally { Job job = tool.getJob(); assertEquals("MR Job should have been configured with UPDATE_STATS job type", job.getConfiguration().get(MAPREDUCE_JOB_TYPE), UPDATE_STATS.name()); } }
Example #12
Source File: Merge.java From examples with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws MasterNotRunningException, ZooKeeperConnectionException, IOException { // tag::MERGE1[] Configuration conf = HBaseConfiguration.create(); Connection connection = ConnectionFactory.createConnection(conf); HBaseAdmin admin = (HBaseAdmin)connection.getAdmin(); List<HRegionInfo> regions = admin.getTableRegions(TableName.valueOf("t1")); //<1> LOG.info("testtable contains " + regions.size() + " regions."); for (int index = 0; index < regions.size() / 2; index++) { HRegionInfo region1 = regions.get(index*2); HRegionInfo region2 = regions.get(index*2+1); LOG.info("Merging regions " + region1 + " and " + region2); admin.mergeRegions(region1.getEncodedNameAsBytes(), region2.getEncodedNameAsBytes(), false); //<2> } admin.close(); // end::MERGE1[] }
Example #13
Source File: Snapshot.java From hbase-tools with Apache License 2.0 | 6 votes |
public static void main(String[] argsParam) throws Exception { setLoggingThreshold("ERROR"); SnapshotArgs args; try { args = new SnapshotArgs(argsParam); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); System.out.println(); System.out.println(usage()); System.exit(1); throw e; } HBaseAdmin admin = HBaseClient.getAdmin(args); Snapshot app = new Snapshot(admin, args); app.run(); }
Example #14
Source File: ExportKeys.java From hbase-tools with Apache License 2.0 | 6 votes |
public ExportKeys(HBaseAdmin admin, Args args) { this.admin = admin; this.args = args; if (args.getTableName().equals(Args.ALL_TABLES)) throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); if (args.getOptionSet().nonOptionArguments().size() != 3) throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); outputFileName = (String) args.getOptionSet().nonOptionArguments().get(2); if (args.has(Args.OPTION_OPTIMIZE)) { exportThreshold = parseExportThreshold(); System.out.println("exporting threshold: " + exportThreshold + " MB"); } else { exportThreshold = 0; System.out.println("exporting threshold is not set"); } }
Example #15
Source File: Snapshot.java From hbase-tools with Apache License 2.0 | 6 votes |
private void deleteOldSnapshots(HBaseAdmin admin, String tableName) throws IOException { if (args.keepCount(tableName) == SnapshotArgs.KEEP_UNLIMITED || args.has(Args.OPTION_TEST) && !tableName.startsWith("UNIT_TEST_")) { System.out.println(timestamp(TimestampFormat.log) + " - Table \"" + tableName + "\" - Delete Snapshot - Keep Unlimited - SKIPPED"); return; } List<SnapshotDescription> sd = SnapshotAdapter.getSnapshotDescriptions(admin, getPrefix(tableName) + ".*"); int snapshotCounter = sd.size(); tableSnapshotCountMaxMap.put(tableName, snapshotCounter); for (SnapshotDescription d : sd) { if (snapshotCounter-- > args.keepCount(tableName)) { String snapshotName = d.getName(); System.out.print(timestamp(TimestampFormat.log) + " - Table \"" + tableName + "\" - Delete Snapshot - Keep " + args.keepCount(tableName) + " - \"" + snapshotName + "\" - "); admin.deleteSnapshot(snapshotName); System.out.println("OK"); } } }
Example #16
Source File: HBaseWriter.java From hiped2 with Apache License 2.0 | 6 votes |
public static void createTableAndColumn(Configuration conf, String table, byte[] columnFamily) throws IOException { HBaseAdmin hbase = new HBaseAdmin(conf); HTableDescriptor desc = new HTableDescriptor(table); HColumnDescriptor meta = new HColumnDescriptor(columnFamily); desc.addFamily(meta); if (hbase.tableExists(table)) { if(hbase.isTableEnabled(table)) { hbase.disableTable(table); } hbase.deleteTable(table); } hbase.createTable(desc); }
Example #17
Source File: SnapshotArgs.java From hbase-tools with Apache License 2.0 | 6 votes |
private void parseTables(HBaseAdmin admin, String[] tables, Set<String> tableSet) throws IOException { for (String table : tables) { final String tableName; if (table.contains(ENTRY_DELIMITER)) { String[] parts = table.split(ENTRY_DELIMITER); tableName = parts[0]; tableKeepMap.put(tableName, Integer.valueOf(parts[1])); tableFlushMap.put(tableName, Boolean.valueOf(parts[2])); } else { tableName = table; } for (HTableDescriptor hTableDescriptor : admin.listTables(tableName)) { tableSet.add(hTableDescriptor.getNameAsString()); } } }
Example #18
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { HServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], HServerLoad.RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example #19
Source File: Manager.java From hbase-tools with Apache License 2.0 | 5 votes |
private Command createCommand(String commandName, HBaseAdmin admin, Args args) throws Exception { for (Class<? extends Command> c : commandSet) { if (c.getSimpleName().toLowerCase().equals(commandName.toLowerCase())) { Constructor constructor = c.getDeclaredConstructor(HBaseAdmin.class, Args.class); constructor.setAccessible(true); return (Command) constructor.newInstance(admin, args); } } throw new IllegalArgumentException(INVALID_COMMAND); }
Example #20
Source File: TableInfo.java From hbase-tools with Apache License 2.0 | 5 votes |
public TableInfo(HBaseAdmin admin, String tableName, Args args) throws Exception { super(); this.admin = admin; this.tableName = tableName; this.args = args; load = new Load(new LevelClass(isMultiTable(), args)); }
Example #21
Source File: Balance.java From hbase-tools with Apache License 2.0 | 5 votes |
public Balance(HBaseAdmin admin, Args args) throws IOException { if (args.getOptionSet().nonOptionArguments().size() != 3) { throw new RuntimeException(Args.INVALID_ARGUMENTS); } this.admin = admin; this.args = args; ruleParam = (String) args.getOptionSet().nonOptionArguments().get(2); tableNameSet = Util.parseTableSet(admin, args); reset(); }
Example #22
Source File: RegionLoadAdapter.java From hbase-tools with Apache License 2.0 | 5 votes |
public RegionLoadAdapter(HBaseAdmin admin, Map<byte[], HRegionInfo> regionMap, Args args) throws IOException { long timestamp = System.currentTimeMillis(); ClusterStatus clusterStatus = admin.getClusterStatus(); Collection<ServerName> serverNames = clusterStatus.getServers(); for (ServerName serverName : serverNames) { ServerLoad serverLoad = clusterStatus.getLoad(serverName); for (Map.Entry<byte[], RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()) { if (regionMap.get(entry.getKey()) != null) regionLoadMap.put(regionMap.get(entry.getKey()), new RegionLoadDelegator(entry.getValue())); } } Util.printVerboseMessage(args, "RegionLoadAdapter", timestamp); }
Example #23
Source File: HbaseTemplate.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public boolean tableExists(String tableName) { try (HBaseAdmin admin = (HBaseAdmin) getConnection().getAdmin()) { return admin.tableExists(TableName.valueOf(tableName)); } catch (IOException e) { throw new RuntimeException(e); } }
Example #24
Source File: Assign.java From hbase-tools with Apache License 2.0 | 5 votes |
public Assign(HBaseAdmin admin, Args args) { if (args.getOptionSet().nonOptionArguments().size() < 2) { throw new IllegalArgumentException(Args.INVALID_ARGUMENTS); } this.admin = admin; this.args = args; }
Example #25
Source File: HbaseTemplate.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public void disableTable(String tableName) { try (HBaseAdmin admin = (HBaseAdmin) getConnection().getAdmin()) { admin.disableTable(tableName); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
Example #26
Source File: HBaseProducer2_0.java From datacollector with Apache License 2.0 | 5 votes |
public void checkHBaseAvailable(List<Stage.ConfigIssue> issues) { try { HBaseAdmin.available(hbaseConnectionHelper.getHBaseConfiguration()); } catch (Exception ex) { LOG.warn("Received exception while connecting to cluster: ", ex); issues.add(getContext().createConfigIssue(Groups.HBASE.name(), null, Errors.HBASE_06, ex.toString(), ex)); } }
Example #27
Source File: CoprocessorHConnectionTableFactoryIT.java From phoenix with Apache License 2.0 | 5 votes |
@Test public void testCachedConnections() throws Exception { final String tableName = generateUniqueName(); final String index1Name = generateUniqueName(); final Connection conn = DriverManager.getConnection(getUrl()); final HBaseAdmin admin = getUtility().getHBaseAdmin(); final MiniHBaseCluster cluster = getUtility().getHBaseCluster(); final HRegionServer regionServer = cluster.getRegionServer(0); Configuration conf = admin.getConfiguration(); final int noOfOrgs = 20; final AtomicBoolean flag = new AtomicBoolean(); flag.set(false); // create table and indices String createTableSql = "CREATE TABLE " + tableName + "(org_id VARCHAR NOT NULL PRIMARY KEY, v1 INTEGER, v2 INTEGER, v3 INTEGER) VERSIONS=1 SPLIT ON ('" + ORG_PREFIX + "-" + noOfOrgs / 2 + "')"; conn.createStatement().execute(createTableSql); conn.createStatement().execute("CREATE INDEX " + index1Name + " ON " + tableName + "(v1)"); List<HRegionInfo> regions = admin.getTableRegions(TableName.valueOf(tableName)); final HRegionInfo regionInfo = regions.get(0); writeToTable(tableName, conn, noOfOrgs); int beforeRegionCloseCount = getActiveConnections(regionServer, conf); int regionsCount = admin.getOnlineRegions(regionServer.getServerName()).size(); admin.unassign(regionInfo.getEncodedNameAsBytes(), true); while(!(admin.getOnlineRegions(regionServer.getServerName()).size() < regionsCount)); int afterRegionCloseCount = getActiveConnections(regionServer, conf); assertTrue("Cached connections not closed when region closes: ", afterRegionCloseCount == beforeRegionCloseCount && afterRegionCloseCount > 0); }
Example #28
Source File: TestEndToEndCoveredColumnsIndexBuilder.java From phoenix with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param tableName name of the table to create for the test * @return the supporting state for the test */ private TestState setupTest(String tableName) throws IOException { byte[] tableNameBytes = Bytes.toBytes(tableName); HTableDescriptor desc = new HTableDescriptor(tableNameBytes); desc.addFamily(FAM1); // add the necessary simple options to create the builder Map<String, String> indexerOpts = new HashMap<String, String>(); // just need to set the codec - we are going to set it later, but we need something here or the // initializer blows up. indexerOpts.put(CoveredColumnsIndexBuilder.CODEC_CLASS_NAME_KEY, CoveredIndexCodecForTesting.class.getName()); Indexer.enableIndexing(desc, CoveredColumnsIndexBuilder.class, indexerOpts); // create the table HBaseAdmin admin = UTIL.getHBaseAdmin(); admin.createTable(desc); HTable primary = new HTable(UTIL.getConfiguration(), tableNameBytes); // overwrite the codec so we can verify the current state HRegion region = UTIL.getMiniHBaseCluster().getRegions(tableNameBytes).get(0); Indexer indexer = (Indexer) region.getCoprocessorHost().findCoprocessor(Indexer.class.getName()); CoveredColumnsIndexBuilder builder = (CoveredColumnsIndexBuilder) indexer.getBuilderForTesting(); VerifyingIndexCodec codec = new VerifyingIndexCodec(); builder.setIndexCodecForTesting(codec); // setup the Puts we want to write final long ts = System.currentTimeMillis(); EnvironmentEdge edge = new EnvironmentEdge() { @Override public long currentTimeMillis() { return ts; } }; EnvironmentEdgeManager.injectEdge(edge); return new TestState(primary, codec, ts); }
Example #29
Source File: HbaseUtil.java From DataLink with Apache License 2.0 | 5 votes |
private static void check(HBaseAdmin admin, HTable htable) throws DataXException, IOException { if (!admin.isMasterRunning()) { throw new IllegalStateException("HBase master 没有运行, 请检查您的配置 或者 联系 Hbase 管理员."); } if (!admin.tableExists(htable.getTableName())) { throw new IllegalStateException("HBase源头表" + Bytes.toString(htable.getTableName()) + "不存在, 请检查您的配置 或者 联系 Hbase 管理员."); } if (!admin.isTableAvailable(htable.getTableName()) || !admin.isTableEnabled(htable.getTableName())) { throw new IllegalStateException("HBase源头表" + Bytes.toString(htable.getTableName()) + " 不可用, 请检查您的配置 或者 联系 Hbase 管理员."); } }
Example #30
Source File: Manager.java From hbase-tools with Apache License 2.0 | 5 votes |
public void run() throws Exception { try (HBaseAdmin admin = HBaseClient.getAdmin(args)) { Command command = createCommand(commandName, admin, args); command.run(); Util.sendAlertAfterSuccess(args, this.getClass()); } catch (Throwable e) { Util.sendAlertAfterFailed(args, this.getClass(), e.getMessage()); throw e; } }