user4874443
user4874443

Reputation:

Clone snapshot of hbase table from one namespace into another namespace

I am using Hbase version 0.98. When I try to clone the hbase table present in namespace "sample1" using snapshot, it is failing.

hbase(main):003:0> snapshot 'sample1:deliverytable_m1' 'deliverytable_m1-Snapshot'

ERROR: wrong number of arguments (1 for 2)

Here is some help for this command:
Take a snapshot of specified table. Examples:

  hbase> snapshot 'sourceTable', 'snapshotName'
  hbase> snapshot 'namespace:sourceTable', 'snapshotName', {SKIP_FLUSH => true}

I want to clone the snapshot into another namespace "sample2" as below. I want 'deliverytable_m2' to be cloned in 'sample2' namespace. How to do it?

clone_snapshot 'deliverytable_m1-Snapshot' 'sample2:deliverytable_m2'

Upvotes: 3

Views: 2773

Answers (2)

derickson82
derickson82

Reputation: 496

The first error you got is simply because you forgot the comma between your arguments. It should look like this:

hbase(main):039:0> snapshot 'sample1:deliverytable_m1', 'deliverytable_m1-Snapshot'

At this point, you should have a snapshot, which you can verify with:

hbase(main):044:0> list_snapshots
SNAPSHOT                                                 TABLE + CREATION TIME
 deliverytable_m1-Snapshot                               sample1:deliverytable_m1 (Thu Sep 17 15:17:31 -0600 2015)
1 row(s) in 0.0110 seconds

=> ["deliverytable_m1-Snapshot"]

Then, assuming the namespace exists, you can clone the snapshot:

hbase(main):045:0> clone_snapshot 'deliverytable_m1-Snapshot', 'sample2:deliverytable_m1'

Upvotes: 3

Ramzy
Ramzy

Reputation: 7138

Are you sure that the table is in sample1 namespace? I hope you have checked with list_namespace_tables 'sample1'. if it is a default namespace, you need not mention it

Upvotes: 0

Related Questions