exporting hbase

Create an HBase table

We need a test table

hbase shell
disable 'testtab'
drop 'testtab'

create 'testtab','cf'
put 'testtab','Key1','cf:Name','Tim'
put 'testtab','Key2','cf:Name','Bill'
put 'testtab','Key3','cf:Name','Bob'
put 'testtab','Key3','cf:House','112'
put 'testtab','Key3','cf:Car','Slk220'
put 'testtab','Key3','cf:Facebook','Bob_Happy'

Make sure the HDFS Directory does not exist

hadoop fs -rmr /home/biadmin/testtab

Backup up the HBase table

hbase org.apache/hadoop.hbase.mapreduce.Export testtab /home/biadmin/testtab


#Verify that there is a file in this directory called _SUCCESS

fs -ls /home/biadmin/testtab

Drop the HBase Table

Obviously make sure you have a backup before proceeding...

hbase shell
disable 'testtab'
drop 'testtab'

Create the Table

This step is needed to create the requirements inside METADATA

create 'testtab','cf'

Load the HDFS Data back in to HBASE

The MapReduce files are Hadoop Sequence Files, these can be reloaded.

base org.apache/hadoop.hbase.mapreduce.Import testtab /home/biadmin/testtab

Checking it all works

hbase shell
scan 'testtab'