示意图
#4种角色共有的安装步骤
yum install gcc zlib zlib-devel fuse fuse-devel fuse-libs libpcap libpcap-devel net-tools useradd mfs -s /sbin/nologin cd /download/ tar xf moosefs-2.0.80.tar.gz cd moosefs-2.0.80 ./configure \ --prefix=/usr/local/mfs \ --with-default-user=mfs \ --with-default-group=mfs \ #client角色要加--enable-mfsmount make && make install chown -R mfs:mfs /usr/local/mfs cd /usr/local/mfs/etc/mfs
#master server设置
cp mfsmaster.cfg.dist mfsmaster.cfg cp mfsexports.cfg.dist mfsexports.cfg cd /usr/local/mfs/var/mfs/ cp metadata.mfs.empty metadata.mfs /usr/local/mfs/sbin/mfsmaster start /usr/local/mfs/sbin/mfscgiserv start netstat -an|grep 94 #实际使用端口9419、9420、9421、9425 echo "/usr/local/mfs/sbin/mfsmaster start">>/etc/rc.local echo "/usr/local/mfs/sbin/mfscgiserv start">>/etc/rc.local chmod +x /etc/rc.d/rc.local
#状态监控网页端口9425
#metalogger设置
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg vi mfsmetalogger.cfg #修改内容 #元数据备份频率,单位是小时 META_DOWNLOAD_FREQ = 1 MASTER_RECONNECTION_DELAY = 5 MASTER_HOST = 192.168.1.92 MASTER_PORT = 9419 /usr/local/mfs/sbin/mfsmetalogger start echo "/usr/local/mfs/sbin/mfsmetalogger start">>/etc/rc.local chmod +x /etc/rc.d/rc.local
#chunkserver设置
cp mfschunkserver.cfg.dist mfschunkserver.cfg vi mfschunkserver.cfg #修改内容 MASTER_HOST = 192.168.1.92 MASTER_PORT = 9420 cp mfshdd.cfg.dist mfshdd.cfg vi mfshdd.cfg #修改内容 /mnt/sdb1 #添加新硬盘后不重启直接识别的命令 echo "scsi add-single-device 0 0 1 0">/proc/scsi/scsi fdisk /dev/sdb mkfs.xfs /dev/sdb1 mkdir /mnt/sdb1 mount /dev/sdb1 /mnt/sdb1 #查看新分区UUID blkid #设置自动挂载 echo "UUID=aeb5555d-08cc-4a9e-91a5-2149d138407c /mnt/sdb1 xfs defaults 0 0" >>/etc/fstab chown -R mfs:mfs /mnt/sdb1 /usr/local/mfs/sbin/mfschunkserver start netstat -an|grep 9422 echo "/usr/local/mfs/sbin/mfschunkserver start">>/etc/rc.local chmod +x /etc/rc.d/rc.local
#client设置
mkdir /mnt/mfs /usr/local/mfs/bin/mfsmount /mnt/mfs/ -H 192.168.1.92 df -h echo "/usr/local/mfs/bin/mfsmount /mnt/mfs/ -H 192.168.1.92">>/etc/rc.local chmod +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
参考资料:
https://www.moosefs.com
http://bbs.chinaunix.net/thread-1644309-1-1.html
http://sery.blog.51cto.com/10037/263515
http://sofar.blog.51cto.com/353572/1429162/
http://soulboy.blog.51cto.com/4007306/1393114
http://opsmysql.blog.51cto.com/2238445/895945
http://shineforever.blog.51cto.com/1429204/1603819/
http://ju.outofmemory.cn/entry/140059
http://ju.outofmemory.cn/entry/111286
http://www.sxt.cn/u/4647/blog/5553
https://ljinliuj-jjliu.rhcloud.com/?p=26
http://blog.liuts.com/post/203/
转载于:https://blog.51cto.com/eafan/1712120