如何在HBase中重命名表?

时间:2015-01-15 14:49:43

标签: shell hbase

我试图在HBase中重命名一个表,但shell中的帮助没有rename命令。 movemv和其他常见的罪魁祸首似乎也不是。

1 个答案:

答案 0 :(得分:56)

要在HBase中重命名表,显然您必须使用快照。因此,您获取表的快照,然后将其克隆为另一个名称。

在HBase shell中:

disable 'tableName'
snapshot 'tableName', 'tableSnapshot'
clone_snapshot 'tableSnapshot', 'newTableName'
delete_snapshot 'tableSnapshot'
drop 'tableName'

SOURCE

http://hbase.apache.org/book.html#table.rename