在CentOS上安装部署MooseFS分布式文件系统

参考资料:

http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-cn-v.1.1.pdf

环境介绍:
OS: CentOS 6.3 x86_64
server1 - mfsmaster & mfschunkserver
server2 - mfsmetalogger & mfschunkserver & mfsclient
server3 - mfschunkserver

1. 什么是MooseFS
MooseFS是一个具有容错能力的分布式文件系统,支持挂载(通过FUSE)和与本地文件系统相同的操作。

MooseFS具有以下几个角色:
主服务器:Managing Server(master server)
数据节点:Data server(chunk servers)
备份服务器:Metadata backup servers(metalogger servers)
客户端:Client computers that access(mount) the files in MooseFS

2. 安装配置主服务器(仅在server1上)
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
sudo rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
sudo yum install mfs

cd /etc/mfs
sudo cp mfsmaster.cfg.dist mfsmaster.cfg
sudo cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
sudo cp mfsexports.cfg.dist mfsexports.cfg

修改主服务器的地址,比如10.197.29.251
sudo vim /etc/mfsmetalogger.cfg

1 MASTER_HOST = 10.197.29.251

初始化数据文件
cd /var/mfs
sudo cp metadata.mfs.empty metadata.mfs

安装WEB界面支持
sudo yum install mfs-cgi httpd
sudo vim /var/www/html/mfs/index.html

1 document.location.href="/cgi-bin/mfs/mfs.cgi"

sudo vim /etc/httpd/conf/httpd.conf

1 Listen 9480

 

sudo /etc/init.d/mfsmaster restart
sudo /etc/init.d/httpd restart

访问WEB界面
http://server1:9480/mfs/

如下图所示
在CentOS上安装部署MooseFS分布式文件系统_第1张图片

3. 安装配置备份服务器(仅在server2上)
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
sudo rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

sudo yum install mfs

cd /etc/mfs
sudo cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

sudo vim /etc/mfsmetalogger.cfg

1 MASTER_HOST = 10.197.29.251

sudo /etc/init.d/mfsmetalogger restart

4. 安装配置数据节点(在server1-3上)
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
sudo rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

sudo yum install mfs

cd /etc/mfs
sudo cp mfschunkserver.cfg.dist mfschunkserver.cfg
sudo cp mfshdd.cfg.dist mfshdd.cfg

sudo vim mfschunkserver.cfg

1 MASTER_HOST = 10.197.29.251

sudo vim mfshdd.cfg

1 /mnt/mfschunks1
2 /mnt/mfschunks2

sudo mkdir /mnt/mfschunks1 /mnt/mfschunks2
sudo chown -R daemon:daemon /mnt/mfschunks*

sudo /etc/init.d/mfschunkserver restart

访问WEB界面,检查新增的chunkserver
http://server1:9480/cgi-bin/mfs/mfs.cgi?sections=CS

5. 安装配置客户端(在server2-3上)
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
sudo rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

sudo yum install mfs-client

sudo mkdir -p /mnt/mfsmount
sudo chown -R daemon:daemon /mnt/mfsmount

sudo mfsmount /mnt/mfsmount -H 10.197.29.251

1 mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root

df -h | grep mfs

1 10.197.29.251:9421         25G     0   25G   0% /mnt/mfs

6. 测试MooseFS
在server2上创建文件server2.txt:
cd /mnt/mfsmount
echo "I am from server2" > server2.txt

在server3上检查文件是否存在:
cd /mnt/mfsmount

ls

server2.txt
 
原文链接: http://heylinux.com/archives/2467.html

你可能感兴趣的:(在CentOS上安装部署MooseFS分布式文件系统)