Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy an existing hbase table

Tags:

I have a Hbase table X and I want to create an exact copy of it and name it Y. Could someone let me know how it is possible?

Thanks

like image 406
user1586205 Avatar asked Jan 03 '14 18:01

user1586205


People also ask

How do I copy a table in HBase?

If your both cluster hbase versions are different then you can use Copytable method. Done your table will be copied. In this if we copy the Hfiles manually from one Hbase cluster to another, in that case list command dispalys all the tables, But scanning a table does not shown any data.

How do I transfer data from one HBase table to another?

To move the data from one HBase cluster to another, use snapshot and either the clone_snapshot or ExportSnapshot utility; or, use the CopyTable utility. To move the data from one HBase cluster to another without downtime on either cluster, use replication.

Can we insert data from one table to another in HBase?

The add() method of Put class is used to insert data. It requires 3 byte arrays representing column family, column qualifier (column name), and the value to be inserted, respectively. Insert data into the HBase table using the add() method as shown below.


1 Answers

Assuming you want to copy the table on the same cluster you can use HBase snapshots in the hbase shell you can

snapshot 'sourceTable', 'sourceTable-snapshot' clone_snapshot 'sourceTable-snapshot', 'newTable' 
like image 115
Arnon Rotem-Gal-Oz Avatar answered Dec 09 '22 12:12

Arnon Rotem-Gal-Oz