In earlier, we had a simple script ‘rename_table.rb’, that would rename the HBase hdfs table directory and then edit hbase:meta table replacing all details of the old table name with the new. The script was deprecated and removed as it was un-maintained. In this article, we will check how to rename HBase table using snapshot with some examples.
How to Rename HBase Table?
You can use HBase snapshot facility to rename the tables. Here is how you would do it using the HBase shell:
Related reading:
- Steps to Migrate HBase Tables from Default to another Namespace
- Read HBase Tables using scan shell command and examples
- Insert data using HBase shell put Command and Examples
- Hbase Namespace Commands and Examples
Step1: Create Snapshot of HBase table that you want to rename
You need to create snapshot to migrate or copy that to different namespace. You must disable the table and then create snapshot.
Step2: Clone Snapshot to new table name
Once table snapshot is created you can clone the snapshot to new table name.
Step3: Use ‘list’ command to check new table
Check new table with list command.
Step4: Delete Snapshot
Once the table is created with new name, you must delete the HBase old table snapshot.
Step5: Drop Original Table
The last step would be to drop the original HBase table.