示意图
#4种角色共有的安装步骤
yum install gcc zlib zlib-devel fuse fuse-devel fuse-libs libpcap libpcap-devel net-toolsuseradd mfs -s /sbin/nologincd /download/tar xf moosefs-2.0.80.tar.gzcd moosefs-2.0.80./configure \--prefix=/usr/local/mfs \--with-default-user=mfs \--with-default-group=mfs \#client角色要加--enable-mfsmountmake && make installchown -R mfs:mfs /usr/local/mfscd /usr/local/mfs/etc/mfs
#master server设置
cp mfsmaster.cfg.dist mfsmaster.cfgcp mfsexports.cfg.dist mfsexports.cfgcd /usr/local/mfs/var/mfs/cp metadata.mfs.empty metadata.mfs/usr/local/mfs/sbin/mfsmaster start/usr/local/mfs/sbin/mfscgiserv startnetstat -an|grep 94#实际使用端口9419、9420、9421、9425echo "/usr/local/mfs/sbin/mfsmaster start">>/etc/rc.localecho "/usr/local/mfs/sbin/mfscgiserv start">>/etc/rc.localchmod +x /etc/rc.d/rc.local
#状态监控网页端口9425
#metalogger设置
cp mfsmetalogger.cfg.dist mfsmetalogger.cfgvi mfsmetalogger.cfg#修改内容#元数据备份频率,单位是小时META_DOWNLOAD_FREQ = 1MASTER_RECONNECTION_DELAY = 5MASTER_HOST = 192.168.1.92MASTER_PORT = 9419/usr/local/mfs/sbin/mfsmetalogger startecho "/usr/local/mfs/sbin/mfsmetalogger start">>/etc/rc.localchmod +x /etc/rc.d/rc.local
#chunkserver设置
cp mfschunkserver.cfg.dist mfschunkserver.cfgvi mfschunkserver.cfg#修改内容MASTER_HOST = 192.168.1.92MASTER_PORT = 9420cp mfshdd.cfg.dist mfshdd.cfgvi mfshdd.cfg#修改内容/mnt/sdb1#添加新硬盘后不重启直接识别的命令echo "scsi add-single-device 0 0 1 0">/proc/scsi/scsifdisk /dev/sdbmkfs.xfs /dev/sdb1mkdir /mnt/sdb1mount /dev/sdb1 /mnt/sdb1#查看新分区UUIDblkid#设置自动挂载echo "UUID=aeb5555d-08cc-4a9e-91a5-2149d138407c /mnt/sdb1 xfs defaults 0 0" >>/etc/fstabchown -R mfs:mfs /mnt/sdb1/usr/local/mfs/sbin/mfschunkserver startnetstat -an|grep 9422echo "/usr/local/mfs/sbin/mfschunkserver start">>/etc/rc.localchmod +x /etc/rc.d/rc.local
#client设置
mkdir /mnt/mfs/usr/local/mfs/bin/mfsmount /mnt/mfs/ -H 192.168.1.92df -hecho "/usr/local/mfs/bin/mfsmount /mnt/mfs/ -H 192.168.1.92">>/etc/rc.localchmod +x /etc/rc.d/rc.local#设置文件副本数量,与chunk数量一致/usr/local/mfs/bin/mfssetgoal -r 2 /mnt/mfs/#查看文件副本数量/usr/local/mfs/bin/mfsgetgoal /mnt/mfs/1.txt#设置回收站清空时间,单位是秒/usr/local/mfs/bin/mfsrsettrashtime 600 /mnt/mfs/
#关闭服务的顺序
umount /mnt/mfs/usr/local/mfs/sbin/mfschunkserver stop/usr/local/mfs/sbin/mfsmetalogger stop/usr/local/mfs/sbin/mfscgiserv stop/usr/local/mfs/sbin/mfsmaster stop
#重要的目录
/usr/local/mfs/var/mfs
恢复master数据的命令
/usr/local/mfs/sbin/mfsmaster -a
参考资料: