hbase 修改表名 Java api(shell)

hbase shell:
01.hbase shell> disable 'tableName'
02.hbase shell> snapshot 'tableName', 'tableSnapshot'
03.hbase shell> clone_snapshot 'tableSnapshot', 'newTableName'
04.hbase shell> delete_snapshot 'tableSnapshot'
05.hbase shell> drop 'tableName'
06.

java code:
01.void rename(HBaseAdmin admin, String oldTableName, String newTableName) {
02. 

String snapshotName = randomName();
03. admin.disableTable(oldTableName);
04. admin.snapshot(snapshotName, oldTableName);
05. admin.cloneSnapshot(snapshotName, newTableName);
06. admin.deleteSnapshot(snapshotName);
07. admin.deleteTable(oldTableName);
08.}

你可能感兴趣的:(经验总结,hbase,shell,修改表名)