HBase跨集群数据迁移的一种方法

从源hbase集群中复制出HBase数据库表到本地目录

  • hadoop fs -get
  • scp到目的集群
  • hadoop fs -put 到目的集群HDFS

亦可使用distcp将集群复制至目标集群
具体办法参考:DistCp

修复.META.表和重新分配数据到各RegionServer

在.META.表没修复时执行重新分配,会报错

#hbase hbck -fixAssignment
...
ERROR: Region { meta => null, hdfs => hdfs://h185:54310/hbase/toplist_ware_total_1009_201232/0403552001eb2a31990e443dcae74ee8, deployed =>  } on HDFS, but not listed in META or deployed on any region server
...

先修复.META.表

#hbase hbck -fixMeta

重新分配到各分区服务器

# hbase hbck -fixAssignments

将刷一下类型日志

12/08/14 18:28:01 INFO util.HBaseFsckRepair: Region still in transition, waiting for it to become assigned: {NAME => 'toplist_ware_total_1009_201232,,1344187094829.0403552001eb2a31990e443dcae74ee8.', STARTKEY => '', ENDKEY => '', ENCODED => 0403552001eb2a31990e443dcae74ee8,}
12/08/14 18:28:02 INFO util.HBaseFsckRepair: Region still in transition, waiting for it to become assigned: {NAME => 'toplist_ware_total_1009_201232,,1344187094829.0403552001eb2a31990e443dcae74ee8.', STARTKEY => '', ENDKEY => '', ENCODED => 0403552001eb2a31990e443dcae74ee8,}

参考:
distcp相关问题可以参考以下博客:https://www.jianshu.com/p/cbace52602aa

    原文作者:咖啡大象不含咖啡
    原文地址: https://www.jianshu.com/p/af69f74fdcfe
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞