mfs容灾恢复之通过备份文件恢复-08

一、概念

mfs metadata数据备份原理

元数据一般有两部分

1、主要的元数据的文件(metadata.mfs,当mfsmaster运行时,metadata.mfs被命名为metadata.mfs.back)每个小时进行同步

2、元数据变更记录文件(changelog.*.mfs)里面存储的是最后N个小时的数据变化,由back_logs参数控制

二、备份数据目录和配置目录

备份var目录和etc目录

cd /usr/local/mfs/
tar -zcvf /opt/var.tar.gz var tar -zcvf /opt/etc.tar.gz etc

注意:一般都建议把备份文件备份到其他服务器,不建议放到本机。

三、模拟机器故障

mfsmaster服务器硬件故障有可能无法修复,就需要重新用其他机器全新安装,修改配置文件等,

用备份的文件解压上传到对应目录

tar -zxvf etc.tar.gz -C /usr/local/mfs/
tar -zxvf var.tar.gz -C /usr/local/mfs/

执行修复

/usr/local/mfs/sbin/mfsmaster -a
[root@mfsmaster sbin]# /usr/local/mfs/sbin/mfsmaster -a
open files limit has been set to: 4096
working directory: /usr/local/moosefs/var/mfs
lockfile created and locked
initializing mfsmaster modules ...
exports file has been loaded
mfstopology configuration file (/usr/local/moosefs/etc/mfstopology.cfg) not found - using defaults
loading metadata ...
loading sessions data ... ok (0.0000)
loading objects (files,directories,etc.) ... ok (0.9475)
loading names ... ok (1.0302)
loading deletion timestamps ... ok (0.0000)
loading quota definitions ... ok (0.0000)
loading xattr data ... ok (0.0000)
loading posix_acl data ... ok (0.0000)
loading open files data ... ok (0.0000)
loading chunkservers data ... ok (0.0000)
loading chunks data ... ok (0.9384)
checking filesystem consistency ... ok
connecting files and chunks ... ok
all inodes: 27
directory inodes: 3
file inodes: 24
chunks: 25
metadata file has been loaded
stats file has been loaded
master <-> metaloggers module: listen on *:9419
master <-> chunkservers module: listen on *:9420
main master server module: listen on *:9421
mfsmaster daemon initialized properly

四、验证

 mfs客户端执行

 

 查看文件

 

posted @ 2021-12-28 17:30  凉生墨客  阅读(179)  评论(0编辑  收藏  举报