以下是CentOS下HBase数据恢复的关键技巧及操作要点:
HMaster/RegionServer宕机
start-hbase.sh
(自动重启Master/RegionServer)。hbase shell
命令查看集群状态。数据文件损坏
hbck
工具检测并修复一致性:/hbase/bin/hbck -repair
。配置错误
hbase-site.xml
等配置文件,修正错误后重启集群。误操作或数据丢失
hbase snapshot
命令创建并恢复快照(需提前创建)。hbase backup
工具的全量/增量备份功能。
hbase backup create full /backup/path
。hbase backup restore /backup/path
。备份现有数据
/hbase/data
)和HDFS数据做备份:cp -r /hbase/data /hbase/data_backup
hdfs dfs -cp /hbase /hdfs/hbase_backup
日志分析与定位
/hbase/logs
下Master/RegionServer日志,定位故障原因(如异常堆栈、错误码)。验证恢复结果
hbase shell
执行status
和scan '表名'
确认数据完整性。hbck
:修复数据一致性。hbase backup/restore
:官方备份恢复工具,支持全量/增量。hadoop distcp
:用于HDFS数据复制(如跨集群恢复)。参考来源: