将 hbase table 的快照从一个命名空间克隆到另一个命名空间

Clone snapshot of hbase table from one namespace into another namespace

我使用的是 Hbase 版本 0.98。当我尝试使用快照克隆命名空间 "sample1" 中存在的 hbase table 时,它失败了。

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}

我想将快照克隆到另一个命名空间 "sample2",如下所示。我想在 'sample2' 命名空间中克隆 'deliverytable_m2'。怎么做?

clone_snapshot 'deliverytable_m1-Snapshot' 'sample2:deliverytable_m2'

您确定 table 在 sample1 命名空间中吗?我希望你已经检查过 list_namespace_tables 'sample1'。如果是默认命名空间,则无需提及

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

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'