Support Questions

Find answers, ask questions, and share your expertise

Merge Two hbase table data

I am having two different hbase tables in same cluster. Both is having same rowkey format and length and also same column family. Both tables are having large data volume. Now I need one table having data of both the tables (Union of both tables). Merge one table data in another is also fine. Is there any way to achieve this? Either using hbase shell or map reduce command?

1 REPLY 1

Rising Star

@Nikunj , You can use copy table utility to copy a table into another table. Since you have the same rowkey format and column family, it should be equivalent to a union. It is documented here https://hbase.apache.org/1.2/book.html#copy.table .

For example, you want to copy table t1 into t2, then

bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --new.name=t2 t1

If you want to copy tables t1 and t2 into t3 then,

bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --new.name=t3 t1
bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --new.name=t3 t2

Note that you should create table t3 first before executing above commands.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.