一.MooseFS简介

MooseFs是一个具有容错功能的网络分布式文件系统.
 
MooseFS独有的特性:
*高可靠性,数据能在不同计算机上存储若干副本。
*通过添加新的计算机或是磁盘来动态扩展空间。
*能存储特定时间内删除的文件。
*建立文件快照,和整个原文件保持一致的副本,原文件也可以正在被访问或写入
 
二. MooseFS架构(如图):
包括四种类型的机器:
*Managing server(master server)
*Data servers(chunk servers)
*Metadata backup servers(metalogger server)
*Client
 

MFS 安装手记_安装手记

 

MFS 安装手记_MFS_02

三.支持的平台:

*Linux (Linux 2.6.14 and up have FUSE support included in the official kernel)

*FreeBSD

*NetBSD

*OpenSolaris

*MacOS X

四.环境如下:

Managing server(master server):                     OS: Centos5.8           IP:10.10.15.212

Metadata backup server (metalogger server):         OS: Centos5.8           IP:10.10.15.213

Data servers(chunk servers):                        OS: Centos5.8           IP:10.10.10.212

                                                    OS: Centos5.8           IP:10.10.10.213

Client(mfsmount):

 

MFS 安装手记_MFS_03

1、安装主控服务器

#wget http://nchc.dl.sourceforge.net/project/moosefs/moosefs/1.6.20/mfs-1.6.20-2.tar.gz

#groupadd  mfs

# useradd mfs -s /sbin/nologi -g mfs

# tar -zxvf mfs-1.6.20-2.tar.gz

# cd mfs-1.6.20-2

# yum -y install zlib zlib-devel gcc make //安装所需的依赖包 

#./configure --prefix=/usr/local/mfs/ --sysconfdir=/usr/local/mfs/ --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount

# make

# make install

# cd /usr/local/mfs/

# cp mfsmaster.cfg.dist mfsmaster.cfg

# cp mfsexports.cfg.dist mfsexports.cfg

# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

# vim mfsexports.cfg

10.10.0.0/16 / rw,alldirs,maproot=0

* . rw

 

# cd /var/lib/mfs/

# cp metadata.mfs.empty metadata.mfs

# vim /etc/hosts

10.10.15.212    mfsmaster

 

# chown -R mfs:mfs /var/lib/mfs/

# chown -R mfs:mfs /web/mfs/

# /usr/local/mfs/sbin/mfscgiserv //开启监控服务,浏览器访问主控端口为9425

# /usr/local/mfs/sbin/sbin/mfsmaster start //启动MFS

# /usr/local/mfs/sbin/sbin/mfsmaster stop //停止MFS

# echo "/usr/local/mfs/sbin/mfscgiserv" >> /etc/rc.d/rc.local

# echo "/usr/local/mfs/sbin/sbin/mfsmaster start" >> /etc/rc.d/rc.local

 

2. metalogger server机器上(备份服务器)

#wget http://nchc.dl.sourceforge.net/project/moosefs/moosefs/1.6.20/mfs-1.6.20-2.tar.gz

#mkdir /usr/local/mfs

#tar -zxvf mfs-1.6.20-2.tar.gz 

#cd mfs-1.6.20-2

#groupadd  mfs

# useradd mfs -s /sbin/nologi -g mfs

#./configure --prefix=/usr/local/mfs/ --sysconfdir=/usr/local/mfs/ --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount

#yum -y install zlib zlib-devel gcc make

#./configure --prefix=/usr/local/mfs/ --sysconfdir=/usr/local/mfs/ --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount

#make

#make install

#cd /usr/local/mfs/

#cp mfsexports.cfg.dist mfsexports.cfg

#cp mfsmaster.cfg.dist mfsmaster.cfg

#cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

#

#修改/etc/hosts添加:

#echo "10.10.15.212 mfsmaster" >> /etc/hosts

#

#/usr/local/mfs/sbin/mfsmetalogger start //启动metalogger

#/usr/local/mfs/sbin/mfsmetalogger stop //关闭metalogger:

# echo "/usr/local/mfs/sbin/mfsmetalogger start" >> /etc/rc.d/rc.local

 

3.Chunk servers 安装(存储块服务器)

#wget http://nchc.dl.sourceforge.net/project/moosefs/moosefs/1.6.20/mfs-1.6.20-2.tar.gz

#tar -zxvf mfs-1.6.20-2.tar.gz 

#cd mfs-1.6.20-2

#groupadd  mfs

# useradd mfs -s /sbin/nologi -g mfs

#./configure --prefix=/usr/local/mfs --sysconfdir=/usr/local/mfs/ --localstatedir=/var/lib --disable-mfsmaster --disable-mfsmount --with-default-user=mfs --with-default-group=mfs

#make

#make install

#cd /usr/local/mfs/

#cp mfschunkserver.cfg.dist mfschunkserver.cfg

#cp mfshdd.cfg.dist mfshdd.cfg

# vim mfschunkserver.cfg

修改存储目录

DATA_PATH = /mfs

 

#echo "10.10.15.212 mfsmaster" >> /etc/hosts

# vim /etc/sysconfig/iptables

-A INPUT -s 10.10.0.0/16 -p tdp -m state --state NEW -m tdp --dport 9400:9500 -j ACCEPT

#mkdir /mfs

#chown -R mfs:mfs /mfs

# chown -R mfs:mfs /var/lib/mfs

#/usr/local/mfs/sbin/mfschunkserver start

# /usr/local/mfs/sbin/mfschunkserver stop

# echo "/usr/local/mfs/sbin/mfschunkserver start" >> /etc/rc.d/rc.local

 

 

4.Client配置

# yum -y install fuse

# wget http://nchc.dl.sourceforge.net/project/moosefs/moosefs/1.6.20/mfs-1.6.20-2.tar.gz

# tar -zxvf mfs-1.6.20-2.tar.gz 

# cd mfs-1.6.20-2

# yum -y install library

#groupadd  mfs

# useradd mfs -s /sbin/nologi -g mfs

#  ./configure --prefix=/usr/local/mfs --disable-mfsmaster --disable-mfschunkserver --enable-mfsmount --with-default-user=mfs --with-default-group=mfs

# make

# make install

# mkdir -p /media/mfs

# echo "10.10.15.212 mfsmaster" >> /etc/hosts

# vim /etc/sysconfig/iptables

-A INPUT -s 10.10.0.0/16 -p tdp -m state --state NEW -m tdp --dport 9400:9500 -j ACCEPT

# service iptables restart

# /usr/local/mfs/bin/mfsmount /media/mfs/ -H mfsmaster

# df -h

 

端口说明:

9421---连接master与MooseFS Client

9422---用于chunkserver之间的连接,监听来自其他数据库服务器的连接。通常是数据复制

9420---用于连接chunkserver,监听来自chunkserver的连接,

9419---用于连接client,监听来自client的连接。

 

遇到的问题:

checking for FUSE... no

configure: error: mfsmount build was forced, but fuse library is too old or not installed

解决方法:yum -y install fuse-devel

读写速度测试:
dd if=/dev/zero of=/media/mfs/test bs=1024M count=1

MFS 安装手记_安装手记_04