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.

Snapshot HBASE

Snapshot HBASE

New Contributor

hi,

 

I try to have a backup of a HBASE tale to another cluster. I can't use replication because we only make bulkload to populate the table. I try the snapshot. It work great if i try to restore my table locally but it make nothing if i want to restore on another cluster.

 

On the master, i create a table with some lines on table HADOOLAP_PRD, i make a snapshot and copy it to the slave:

[hdfs@master ~]$ hbase shell
15/08/12 11:18:41 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.6-cdh5.3.0, rUnknown, Tue Dec 16 19:13:29 PST 2014

hbase(main):001:0> count 'HADOOLAP_PRD'
74 row(s) in 0.2440 seconds

=> 74
hbase(main):002:0> snapshot 'HADOOLAP_PRD', 'test'
0 row(s) in 0.4260 seconds

hbase(main):003:0> exit
[hdfs@master ~]$/usr/bin/hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot test -copy-to hdfs://slave:8020/hbase -chuser hbase -chgroup hbase
....
        org.apache.hadoop.hbase.snapshot.ExportSnapshot$Counter
                BYTES_COPIED=3676
                BYTES_EXPECTED=3676
                FILES_COPIED=1
        File Input Format Counters
                Bytes Read=0
        File Output Format Counters
                Bytes Written=0
15/08/12 11:28:46 INFO snapshot.ExportSnapshot: Finalize the Snapshot Export
15/08/12 11:28:46 INFO snapshot.ExportSnapshot: Verify snapshot integrity
15/08/12 11:28:46 INFO Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS
15/08/12 11:28:46 INFO snapshot.ExportSnapshot: Export Completed: test

 

On the slave, i restore my snapshot but the table is empty:

[hdfs@slave ~]# hbase shell
15/08/12 11:29:26 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.6-cdh5.3.0, rUnknown, Tue Dec 16 19:13:29 PST 2014

hbase(main):001:0> disable 'HADOOLAP_PRD'
0 row(s) in 3.3470 seconds

hbase(main):002:0> restore_snapshot 'test'
0 row(s) in 0.8830 seconds

hbase(main):003:0> enable 'HADOOLAP_PRD'
0 row(s) in 0.2710 seconds

hbase(main):004:0> count 'HADOOLAP_PRD'
0 row(s) in 0.1290 seconds

=> 0

 

What i have doing wrong?

 

Stephane

5 REPLIES 5

Re: Snapshot HBASE

Master Guru
Do you get the same behaviour if you use clone_snapshot to create a new table out of the added snapshot, and then count on it?

Re: Snapshot HBASE

New Contributor
If i try clone_snapshot, hbase shell hang, no error, no succes, nothing. I need to press Ctrl+C to leave shell.

Re: Snapshot HBASE

New Contributor

Did you ever figure this out? I'm seeing the exact same behavior in CDH 5.4.2

Re: Snapshot HBASE

New Contributor

I figured out the problem, I was running the Export command as the hdfs user, which means the files that get created on HDFS are owned by the hdfs user.  

 

For whatever reason using the chuser and chgroup flags doesn't seem to help either:

 

hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot dantest-snapshot -copy-to hdfs://cluster2:8020/hbase -chuser hbase -chgroup hbase -mappers 16

 

at the end of the day doing something like the following on the destination cluster works:

 

hdfs dfs -chown -R hbase:hbase /hbase

 

As far as I can tell, if hbase doesn't have permission to something it will just sit trying to run the command forever in hbase shell.

 

Highlighted

Re: Snapshot HBASE

New Contributor

Even I have seen similar issue about permisioning, wondering how cloudera support doesn't lead to the answer rather than just asking for experimenting different commands.