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.
A column family cannot be renamed. The common approach to rename a family is to create a new family with the desired name and copy the data over, using the API. Reference Hbase - The Definitve Guide.
You can use the alter command to add, modify or delete column families or change table configuration options. specification can either be a name string, or a dictionary with the NAME attribute.
Hi Youngwoo, Correct - no support for renaming a table in Phoenix currently (see PHOENIX-2341). Apparently, you can use the HBase snapshot feature to rename tables[1]. Using that technique, you could potentially surface this in Phoenix and add the logic required to update the SYSTEM.
Use PUT command to insert data to rows and columns on an HBase table.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With