各种角色作用:
1 管理服务器:负责各个数据存储服务器的管理,文件读写调度,文件空间回收以及恢复.多节点拷贝
2 元数据日志服务器: 负责备份master服务器的变化日志文件,文件类型为changelog_ml.*.mfs,以便于在master server出问题的时候接替其进行工作
3 数据存储服务器:负责连接管理服务器,听从管理服务器调度,提供存储空间,并为客户提供数据传输.
4 客户端: 通过fuse内核接口挂接远程管理服务器上所管理的数据存储服务器,.看起来共享的文件系统和本地unix文件系统使用一样的效果.
安装环境
Master Server
master 10.0.0.141 Centos5.5(64X)
Metalogger Server
metalogger 10.0.0.142 Centos5.5(64X)
Chunk Servers
chunk01 10.0.0.143 Centos5.5(64X)
chunk02 10.0.0.144 Centos5.5(64X)
Client Server
client01 10.0.0.150 Centos5.5(64X)
client02 10.0.0.155 Centos5.5(64X)
—————————————————-
master 安装(10.0.0.141)
mkdir -p /root/tools/moosefs/
cd /root/tools/moosefs/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/elain/apps/mfs/lib
–with-default-user=mfs
–with-default-group=mfs
–disable-mfschunkserver
–disable-mfsmount
make && make install
cd ..
cd /elain/apps/mfs/etc/
cp mfsmaster.cfg.dist mfsmaster.cfg
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
cp mfsexports.cfg.dist mfsexports.cfg
vi mfsexports.cfg
10.0.0.0/24 / rw,alldirs,maproot=0
cd /elain/apps/mfs/lib/mfs
cp metadata.mfs.empty metadata.mfs
vi /etc/hosts
10.0.0.141 mfsmaster
运行mfs服务
/elain/apps/mfs/sbin/mfsmaster start
master metaloggers module: listen on *:9419
master chunkservers module: listen on *:9420
main master server module: listen on *:9421
运行监控平台
/elain/apps/mfs/sbin/mfscgiserv
starting simple cgi server (host: any , port: 9425 , rootpath: /elain/apps/mfs/share/mfscgi)
这时,可通过浏览器访问:http://10.0.0.141:9425/ 查看 master 的运行情况
—————————————————–
metalogger 安装(10.0.0.142)
cd /root/tools/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/elain/apps/mfs/lib
–with-default-user=mfs
–with-default-group=mfs
–disable-mfschunkserver
–disable-mfsmount
make && make install
cd ..
cd /elain/apps/mfs/etc/
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
vi /etc/hosts
10.0.0.141 mfsmaster
/elain/apps/mfs/sbin/mfsmetalogger start
—————————————————-
Chunk01 安装(10.0.0.143)
cd /root/tools/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/elain/apps/mfs/lib
–with-default-user=mfs
–with-default-group=mfs
–disable-mfsmaster
make && make install
cd ..
cd /elain/apps/mfs/etc/
cp mfschunkserver.cfg.dist mfschunkserver.cfg
cp mfshdd.cfg.dist mfshdd.cfg
vi /etc/hosts
10.0.0.141 mfsmaster
mkdir /data/mfschunks{1,2}
chown -R mfs:mfs /data/mfschunks{1,2}
vi /elain/apps/mfs/etc/mfshdd.cfg
/data/mfschunks1
/data/mfschunks2
/elain/apps/mfs/sbin/mfschunkserver start
————————————————-
Chunk02 安装(10.0.0.144)
cd /root/tools/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/elain/apps/mfs/lib
–with-default-user=mfs
–with-default-group=mfs
–disable-mfsmaster
make && make install
cd ..
cd /elain/apps/mfs/etc/
cp mfschunkserver.cfg.dist mfschunkserver.cfg
cp mfshdd.cfg.dist mfshdd.cfg
vi /etc/hosts
10.0.0.141 mfsmaster
mkdir /data/mfschunks{1,2}
chown -R mfs:mfs /data/mfschunks{1,2}
vi /elain/apps/mfs/etc/mfshdd.cfg
/data/mfschunks1
/data/mfschunks2
/elain/apps/mfs/sbin/mfschunkserver start
———————————————————
Client01 Server安装 (10.0.0.150)
cd /root/tools/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/fuse/fuse-2.X/2.8.5/fuse-2.8.5.tar.gz
tar -zxvf fuse-2.8.5.tar.gz
cd fuse-2.8.5
./configure
make
make install
cd ..
运行以下export命令,否则挂载moosefs系统会失败
vi /etc/profile
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
source /etc/profile
cd /root/tools/moosefs/
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar -zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/www/lib
–with-default-user=mfs
–with-default-group=mfs
–enable-mfsmount
make && make install
cd ..
vi /etc/hosts
10.0.0.141 mfsmaster
挂接操作
mkdir -p /elain/data/htdocs/elain/upload
/elain/apps/mfs/bin/mfsmount /elain/data/htdocs/elain/upload/ -H mfsmaster
umount -l /elain/data/htdocs/elain/upload
——————————————————-
Client02 Server安装 (10.0.0.155)
cd /root/tools/
/usr/sbin/groupadd -g 660 mfs
/usr/sbin/useradd -g mfs mfs -u 660 -s /sbin/nologin
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/fuse/fuse-2.X/2.8.5/fuse-2.8.5.tar.gz
tar zxvf fuse-2.8.5.tar.gz
cd fuse-2.8.5
./configure
make
make install
cd ..
运行以下export命令,否则挂载moosefs系统会失败
vi /etc/profile
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
source /etc/profile
#加载fuse
modprobe fuse
[root@web1 ~#]lsmod |grep fuse
fuse 83057 8
wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.20-2.tar.gz
tar -zxvf mfs-1.6.20-2.tar.gz
cd mfs-1.6.20-2
./configure
–prefix=/elain/apps/mfs
–sysconfdir=/elain/apps/mfs/etc
–localstatedir=/elain/apps/mfs/lib
–with-default-user=mfs
–with-default-group=mfs
–enable-mfsmount
make && make install
cd ..
vi /etc/hosts
10.0.0.141 mfsmaster
挂接操作
mkdir -p /mnt/mfs
/elain/apps/mfs/bin/mfsmount /mnt/mfs -H mfsmaster
安装完毕。
停止 MooseFS
为了安全停止 MooseFS 集群,建议执行如下的步骤:
umount -l /mnt/mfs #客户端卸载MooseFS 文件系统
/elain/apps/mfs/sbin/mfschunkserver stop #停止 chunk server 进程
/elain/apps/mfs/sbin/mfsmetalogger stop #停止 metalogger 进程
/elain/apps/mfs/sbin/mfsmaster stop #停止主控 master server 进程
安全的启动MooseFS集群
/elain/apps/mfs/sbin/mfsmaster start #启动 master 进程
/elain/apps/mfs/sbin/mfschunkserver start #启动 chunkserver 进程
/elain/apps/mfs/sbin/mfsmetalogger start #启动 metalogger 进程
/elain/apps/mfs/bin/mfsmount /mnt/mfs -H master #客户端挂载 MooseFS 文件系统
MooseFS 命令的使用方法及参考文档:
http://www.moosefs.org/reference-guide.html#using-moosefs
http://www.moosefs.org/moosefs-faq.html
FAQ:
/elain/apps/mfs/bin/mfsmount /elain/data/htdocs/elain/upload -H master
mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root
fuse: device not found, try 'modprobe fuse' first
error in fuse_mount
答:modprobe fuse
[root@client01 ~]# lsmod |grep fuse
fuse 83057 6