Support Questions
Find answers, ask questions, and share your expertise

How to import snapshot under Hadoop Directory into Hbase Shell

Highlighted

How to import snapshot under Hadoop Directory into Hbase Shell

Listed below are the steps taken for copying a table from one host onto another.

1. We took a snapshot of our table on a single node machine.

2. Move snapshot from HBase Shell to Hadoop Directory.

3. CopyToLocal Directory from Hadoop Directoy to Secure copy onto another host on a different subnet.

4. CopyFromLocal Directory to Hadoop Directory.

We are now on the last step which is to bring the snapshot folder back into HBase and restore it in HBase Shell.

Any suggestions or insight would be greatly appreciated!

3 REPLIES 3

Re: How to import snapshot under Hadoop Directory into Hbase Shell

Contributor

Hi, there's a documentation for export hbase table snapshot to another cluster: http://hbase.apache.org/book.html#ops.snapshots.export

If this doesn't meet your scenario (like the two clusters cannot connect with each other), I suggest just copyToLocal the /hbase/data/default/<table_name> directory and copyFromLocal to another cluster's hdfs(using the same directory path), and finally use 'hbase hbck -repair' to complete the migration.

Highlighted

Re: How to import snapshot under Hadoop Directory into Hbase Shell

To restore, you need to copy the exported files into the destination HBase installation directory.

1.
hdfs dfs -cp /<export_dir>/.hbase-snapshot/<snapshot_name> ${hbase.rootdir}/.hbase-snapshot/

2.

hdfs dfs -mkdir -p ${hbase.rootdir}/archive/data/default

3.

hdfs dfs -cp /<export_dir>/archive/data/default/<TABLE_NAME> ${hbase.rootdir}/archive/data/default/

After this, you should be able to see your snapshot in the hbase shell via `list_snapshots` and then use `clone_snapshot` create a table from that snapshot.

Highlighted

Re: How to import snapshot under Hadoop Directory into Hbase Shell

New Contributor

Is it possible to directly storing the output of ExportSnapshot to ${hbase.rootdir}/ path instead of copying again?