How Do You Rename a Table in HBase?

2019-03-09 17:39发布

I'm trying to rename a table in HBase but the help in the shell doesn't have a rename command. move, mv and other common culprits don't appear to be it, either.

标签: shell hbase
1条回答
淡お忘
2楼-- · 2019-03-09 18:16

To rename a table in HBase, apparently you have to use snapshots. So, you take a snapshot of the table and then clone it as a different name.

In the 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

查看更多
登录 后发表回答