Clone snapshot of hbase table from one namespace into another namespace

时间:2015-07-28 16:11:53

标签: hadoop hbase

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'

2 个答案:

答案 0 :(得分:1)

您遇到的第一个错误只是因为您忘记了参数之间的逗号。它应该是这样的:

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

此时,您应该有一个快照,您可以通过以下方式验证:

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"]

然后,假设命名空间存在,您可以克隆快照:

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

答案 1 :(得分:0)

您确定该表位于sample1名称空间中吗?我希望您使用 list_namespace_tables' sample1' 进行了检查。如果它是默认命名空间,则无需提及