背景:HBase Cluster1 -> HBase Cluster2 【利用HBase的Snapshots功能,进行集群之间的HBase数据前移】
1.开启Snapshots功能(0.95及以上版本默认开启了)
<property>
<name>hbase.snapshot.enabled
</name>
<value>true
</value>
</property>
2. 创建Snapshot(在Cluster1上操作)
$ hbase shell
hbase> snapshot
'myTable',
'myTableSnapshot-122112'
3. 执行迁移
3.1 推式(在Cluster1上操作)
$ hbase org
.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot MySnapshot -copy-to
hdfs://cluster1:
8020/hbase_root_dir -mappers
16
3.2 拉式(在Cluster2上操作)
$ hbase org
.apache
.hadoop
.hbase
.snapshot
.ExportSnapshot
-snapshot MySnapshot
-copy-from hdfs:
-copy-to hdfs:
4. 恢复数据(在Cluster2上操作)
$ hbase shell
hbase> restore_snapshot
'myTableSnapshot-122112'
https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.4/bk_hbase_snapshots_guide/content/ch_hbase_snapshots_chapter.html