Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Cloning a New table or Restoring a Snapshot

Cloning a New table or Restoring a Snapshot

New Contributor

Hi All,

I have taken a Snapshot in my Dev Environment and Exported to PreProd environment so that I can clone a new table from snapshot or else I can restore it.

I exported the snapshot from Dev to Pre Prod using below command:

/usr/bin/hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot snapshot_table_name -copy-to hdfs://NAME_NODE:8020/hbase -mappers 5

My problem is when I try to clone the table from this exported snapshot I get error Unknown Snapshot and also this exported snapshot is not showing up when I hit list_snapshot commad in Hbase shell.

I can see the exported snapshot in hdfs using below command as I gave the hdfs path as hdfs://NAME_NODE:8020/hbase:

hadoop fs -ls /hbase

However all the other snapshots which I created in Pre Prod are present in the below location:

hadoop fs -ls /apps/hbase/data

How can I resolve this issue? Is there a problem in the way I exported the Snapshot? Do i have to export the snapshot and give the path as hdfs://NAME_NODE:8020/apps/hbase/data ?

Request for assistance.

3 REPLIES 3

Re: Cloning a New table or Restoring a Snapshot

Expert Contributor

Hi,

I do t know for the snapshot but you can have the same result by doing an export and the. And import of your table. In the following link you have an example how to do it:

http://www.rotanovs.com/hbase/hbase-importexport/

Michel

Re: Cloning a New table or Restoring a Snapshot

Cloudera Employee

Hi @Akash S,

You need to specify the value of "hbase.rootdir" in PreProd as the "-copy-to" parameter in ExportSnapshot. And looks like the value is "hdfs://NAME_NODE:8020/apps/hbase/data".

So you can execute the following command and the export will be successful: /usr/bin/hbase

org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot snapshot_table_name -copy-to hdfs://NAME_NODE:8020/apps/hbase/data -mappers 5

Re: Cloning a New table or Restoring a Snapshot

You need to move your snapshot from exported directory to the directory where hbase looks for snapshots(.hbase-snapshot). so that list_snapshots and other commands(like clone_snapshot ) can work easily

hadoop dfs -mv hdfs://NAME_NODE:8020/hbase/.hbase-snapshot/<snapshot_name> hdfs://NAME_NODE:8020/apps/hbase/data/.hbase-snapshot/
hdfs dfs -mv hdfs://NAME_NODE:8020/hbase/archive/data/* hdfs://NAME_NODE:8020/apps/hbase/data/archive/data/

FYI:- to list snapshot directly from remote directory

hbase org.apache.hadoop.hbase.snapshot.SnapshotInfo -remote-dir hdfs://NAME_NODE:8020/hbase/ -list-snapshots
Don't have an account?
Coming from Hortonworks? Activate your account here