关于HbaseSnapshot迁移得理解

本文解析了HBase快照的工作原理及如何利用ExportSnapshot工具实现跨集群的数据迁移。快照只记录元数据,而实际的数据文件由ExportSnapshot通过MapReduce任务从源集群复制到目标集群。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在进行Hbase数据迁移的时候,发现HbaseSnapshot是比较常用的一种方法,个人理解快照应该是元数据而不包含数据的,类似与HDFS快照
如果使用HDFS进行数据迁移要使用到distcp.但是为什么hbase得快照迁移不需要迁移数据呢,执行命令就可以通过快照做到数据迁移

sudo –u hdfs hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot s1 –copy-from hdfs://ip:port/hbase –copy-to hdfs://ip:port/hbase –mappers 16 –chuser hbase –chgroup hbase

我了解到的Hbase快照的定义是

HBase表快照时瞬时的,几乎对整个机器没有任何性能影响
HBase快照是一系列的元数据信息集合,可以通过快照将表恢复到生成快照时的状态
快照不是表的复制,而是记录元数据(表信息和域)和数据(HFiles,内存存储,WALs)一系列操作的集合,在生成快照操作中没有任何执行复制数据的动作

既然本身并没有数据是如何进行得迁移呢,答案在ExportSnapshot中

You can export any snapshot from one cluster to another. Exporting the
snapshot copies the table’s hfiles, logs, and the snapshot metadata,
from the source cluster to the destination cluster. Specify the
-copy-from option to copy from a remote cluster to the local cluster or another remote cluster. If you do not specify the -copy-from
option, the hbase.rootdir in the HBase configuration is used, which
means that you are exporting from the current cluster. You must
specify the -copy-to option, to specify the destination cluster.

The ExportSnapshot tool executes a MapReduce Job similar to distcp to
copy files to the other cluster. It works at file-system level, so the
HBase cluster can be offline.

Run ExportSnapshot as the hbase user or the user that owns the files.
If the user, group, or permissions need to be different on the
destination cluster than the source cluster, use the -chuser,
-chgroup, or -chmod options as in the second example below, or be sure the destination directory has the correct permissions. In the
following examples, replace the HDFS server path and port with the
appropriate ones for your cluster.

当时混淆了Snapshot和ExportSnapshot得含义,以为ExportSnapshot仅仅是导出一个快照,实际上并不是…
记录一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值