Steps to Migrate HBase Tables from Default to another Namespace

  • Post author:
  • Post last modified:February 28, 2018
  • Post category:BigData
  • Reading time:4 mins read

In Hbase, you can create different namespaces as per your requirements. You can think namespace as schema in relational database. When you create HBase tables without specifying namespace then tables will be available in “default” namespace. In this article, we will check steps to migrate HBase tables from default to another namespace with some examples.

Steps to Migrate HBase Tables from Default to another Namespace

HBase Snapshots

You can INSERT (single value at a time) data into tables that is present in another namespace using HBase PUT command. But, you can’t use the HBase put command to copy entire table to another namespace.

HBase supports the concept called snapshot, you can create snapshot of the existing table in the default namespace and then clone that in required namespace.

Related reading:

HBase Create Table Snapshot

Below is the syntax for creating namespace in HBase:

HBase Create Table Snapshot Example

Below example demonstrates the HBase table snapshot creation:

Steps to Migrate HBase Tables from Default to another Namespace

You can follow below steps to copy Hbase table from default namespace to another namespace:

Step1: Create Snapshot of HBase table

You need to create snapshot to be migrated or copy to different namespace. You must disable the table and then create snapshot.

Step2: Clone Snapshot to new Namespace with same or different table names

Once table snapshot is created you can clone the snapshot to new namespace.

Step3: Use Scan Command to Verify Table in New namespace

Check the migrated table with scan command.

Step4: Delete Snapshot

Once the table is migrated, you must delete the HBase table snapshot.

Step5: Drop Original Table

The last step would be to drop original HBase table that you just migrated to new namespace.