Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do You Rename a Table in HBase?

Tags:

shell

hbase

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.

like image 317
WattsInABox Avatar asked Jan 15 '15 14:01

WattsInABox


People also ask

How do I rename a column in HBase?

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.

Which HBase shell command do we use to modify HBase table configuration?

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.

How do I rename a table in Phoenix?

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.

Which HBase command is used to insert a new record into the table?

Use PUT command to insert data to rows and columns on an HBase table.


1 Answers

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

like image 124
WattsInABox Avatar answered Sep 23 '22 17:09

WattsInABox