mfs master 安装
建议 cp eth0 eth0:0
ifup eth0:0
修改 vim/etc/hosts
cd /home/oldboy/tools
groupadd mfs
useradd -g mfs mfs -s /sbin/nologin
yum install fuser* zlib* -y
tar zxf mfs-1.6.27-5.tar.gz
cd mfs-16.27
./configure --prefix=/application/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs
make
make install
ln -s /application/mfs-1.6.27 /application/mfs
ll /aaplication/ |grep mfs
设置用户名和组
vim mfsmaster.cfg
WORKING_USER = mfs
WORKING_GROUP = mfs
设置挂载点
cat >mfsexports.cfg< #ALLOW "meta" * . rw #启用回收站 #ALLow everything but "meta" 10.0.0.0/24 / rw,alldirs,mppall=mfs:mfs,password=111111 #设置:网段,挂载目录,权限,用户密码 EOF 启动 cd /application/mfs/var/mfs cp metadata.mfs.mepty metadata.mfs echo "exprt PATH=$PATH:/application/mfs/sbin:/application/mfs/bin" >>/etc/profile tail -l /etc/profile /application/mfs/sbin/mfsmaster start netstat -lntup |grep 94 echo $PATH 设置开机启动 echo "/application/mfs/sbin/mfsmaster start" >>/etc/rc.local 启动图型 mfscgiserv start http://10.0.0.7:9425 安装backup groupadd mfs useradd -g mfs mfs -s /sbin/nologin yum install fuser* zlib* -y tar zxf mfs-1.6.27-5.tar.gz cd mfs-16.27 ./configure --prefix=/application/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs make make install ln -s /application/mfs-1.6.27 /application/mfs ll /aaplication/ |grep mfs 设置环境变量 echo "exprt PATH=$PATH:/application/mfs/sbin:/application/mfs/bin" >>/etc/profile tail -l /etc/profile cp mfsmetalogger.cfg.dist mfsmetalogger.cfg vim mfsmetalogger.cfg MASTER_HOST = mfsmaster.etiantian.org #修改maste的 ip地址或者域名 启动 /application/mfs/sbin/mfsmetalogger start netstat -lntup |grep mfs netstat -lntup |grep 94 netstat -an |grep -i est chown -R mfs /application/mfs/var/mfs tail -f /var/log/messages 设置开机启动 echo "/application/mfs/sbin/mfsmetalogger start" >>/etc/rc.local data安装 groupadd mfs useradd -g mfs mfs -s /sbin/nologin yum install fuser* zlib* -y tar zxf mfs-1.6.27-5.tar.gz cd mfs-16.27 ./configure --prefix=/application/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs make make install ln -s /application/mfs-1.6.27 /application/mfs ll /aaplication/ |grep mfs 设置环境变量 echo "exprt PATH=$PATH:/application/mfs/sbin:/application/mfs/bin" >>/etc/profile tail -l /etc/profile vim mfschunkserver.cfg MASTER_HOST = mfsmaster.etiantian.org # 修改master ip地址或者域名 修改挂载目录 vim /application/mfs/etc/mfs/mfshdd.cfg /msfdata #可以设置多个 chown -R mfs.mfs /msfdata 启动 /application/mfs/sbin/mfschunkserver start 其它几台server 安装一样 安装客户端 如果客户端没有fuse 需要安装 wget http://nchc.dl.sourceforge.net/project/fuse/fuse-2.X/2.9.2/fuse-2.9.2.tar.gz ./configure make make install groupadd mfs useradd -g mfs mfs -s /sbin/nologin yum install fuser* zlib* -y tar zxf mfs-1.6.27-5.tar.gz cd mfs-16.27 ./configure --prefix=/application/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs make make install ln -s /application/mfs-1.6.27 /application/mfs ll /aaplication/ |grep mfs 方法(1)设置开机自动加载fuse到内核 echo "/modprobe fuse" >/etc/sysconfig/modules/fuse.modules chmod 755 /etc/sysconfig/modules/fuse.modules 方法(2)设置开机自动加载fuse到内核 echo "modprobe fuse" >>/etc/ec.modules chmod 755 /etc/rc.modules 挂载 /application/mfs/bin/mfsmount /mnt/mfs -H mfsmster.etiantian.org -o mfspassword=111111 搭建完成 随便创建几个文件 分别在master和backup查看日志 cat /application/mfs/var/mfs/changelog_ml 查看文件命令 mfsfileinfo 1 设置副本:为3份 mfssetgoal -r 3 a1 查看数量 mfsfileinfo al/10 测试 创建文件 dd if=/dev/zero of=/mnt/mfs/test/10m.img bs=1M count=10 mfsfileinfo test/10m.img 查看删除文件时间 mfsgettrashtime 10m.img 设置文件删除时间 mfssettrashtime -r 1200 /a2 客户端挂载回收站 mfsmaster.etiantian.org -m /mnt/mfs-trash/ 还原文件 移动删除的文件到 undel下即可 mv 0000002\|a2\|oldboy.txt undel/ 备份master与master恢复1 需要备份下面两个文件 /application/mfs/var/ /application/mfs/etc/ 脚本 while true do cd /application/mfs rsyrc -azv var /opt/ >/dev/null 2>&1 rsyrc -azv etc /opt/ >/dev/null 2>&1 usleep 500000 done sh -x bakmeta.sh sh bakmeta.sh & 恢复master 新安装机器用上面备份的文件直接覆盖即可 mfsmetarestore -a /application/mfs/sbin/mfsmaster start 客户端需要重新挂载 umount /mnt/mfs /application/mfs/bin/mfsmount /mnt/mfs -H mfsmster.etiantian.org -o mfspassword=111111 备份master与master恢复2 首先该ip地址 建议 cp eth0 eth0:0 ifup eth0:0 修改 vim/etc/hosts 把上面备份好的rsyrc -azv etc /opt/ 拷贝到 /application/mfs 下面 mfsmetalogger -s cd /application/mfs mfsmetalogger -m metadata_ml.mfs.back* -o metadata.mfs changelog_ml* mfsmaster start netstat -lntup |grep 94 mfscgiserv start 解决单点故障 利用keepalived+inotify 实现 mfs master的高可用