分布式文件系统MooseFS初探
这几天在看架构方面的资料,关于共享存储方面的参考sery的文章,自已简单的测试了一下,测试步骤及结果如下:
一,测试环境:
服务器用途 |
操作系统 |
IP地址 |
服务器型号 |
CPU型号 |
内存 |
Master Server |
CentOS 5.2 Final x86_64 |
192.168.0.180 |
IBM System x3550 |
Intel(R) Xeon(R) CPU E5420 @ 2.50GHz |
8GB |
Matelogger Server |
CentOS 5.2 Final x86_64 |
192.168.0.178 |
IBM System x3550 |
Intel(R) Xeon(R) CPU E5420 @ 2.50GHz |
8GB |
Chunk Server |
CentOS 5.2 Final x86_64 |
192.168.0.172 |
IBM System x3550 |
Intel(R) Xeon(R) CPU E5420 @ 2.50GHz |
8GB |
Chunk Server |
CentOS 5.2 Final x86_64 |
192.168.0.176 |
IBM System x3550 |
Intel(R) Xeon(R) CPU E5420 @ 2.50GHz |
8GB |
Client |
CentOS 5.2 Final x86_64 |
192.168.0.197 |
IBM System x3550 |
Intel(R) Xeon(R) CPU E5420 @ 2.50GHz |
8GB |
二,Master server安装及配置:
1,建组及用户:
groupadd mfs
useradd -g mfs mfs
2,编译及安装:
./configure --prefix=/usr/local/mfs --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount
make && make install
3,更改相关文件:
[[email protected] mfs]# cd /etc/
[[email protected] etc]# cp mfsmaster.cfg.dist mfsm
mfsmaster.cfg.dist mfsmetalogger.cfg.dist
[[email protected] etc]# cp mfsmaster.cfg.dist mfsmaster.cfg
[[email protected] etc]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
[[email protected] etc]# cp mfsexports.cfg.dist mfsexports.cfg
[[email protected] mfs]# cd /var/lib/mfs/
[[email protected] mfs]# cp metadata.mfs.empty metadata.mfs
[[email protected] etc]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.0.180 mfsmaster
4,启动服务:
[[email protected] mfs]# /usr/local/mfs/sbin/mfsmaster start
working directory: /var/lib/mfs
lockfile created and locked
initializing mfsmaster modules ...
loading sessions ... ok
sessions file has been loaded
exports file has been loaded
loading metadata ...
create new empty filesystemmetadata file has been loaded
no charts data file - initializing empty charts
master <-> metaloggers module: listen on *:9419
master <-> chunkservers module: listen on *:9420
main master server module: listen on *:9421
mfsmaster daemon initialized properly
[email protected] mfs]# /usr/local/mfs/sbin/mfscgiserv
starting simple cgi server (host: any , port: 9425 , rootpath: /usr/local/mfs/share/mfscgi)
三,Matelogger Server安装及配置:
1,建组及用户:
groupadd mfs
useradd -g mfs mfs
mkdir -p /var/bak/mfschunk01/
chown mfs.mfs /var/bak/mfschunk01/
2,编译及安装:
./configure --prefix=/usr/local/mfs --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount
make && make install
3,更改相关文件:
[[email protected] mfs-1.6.17]# cd /etc/
[[email protected] etc]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
[[email protected] etc]# vi /etc/mfsmetalogger.cfg
MASTER_HOST = mfsmaster
MASTER_PORT = 9419
#去掉上面2行的注释
[[email protected] etc]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 sworddb.com localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
114.80.160.5 kuafu.com
192.168.0.178 mfsmaster
4,启动服务:
[[email protected] etc]# /usr/local/mfs/sbin/mfsmetalogger start
working directory: /var/lib/mfs
lockfile created and locked
initializing mfsmetalogger modules ...
mfsmetalogger daemon initialized properly
四,Chunk Server 1 安装及配置:
1,建组及用户:
groupadd mfs
useradd -g mfs mfs
2,编译及安装:
./configure --prefix=/usr/local/mfs --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster
make && make install
3,更改相关文件:
[[email protected] mfs-1.6.17]# cd /etc/
[[email protected] etc]# cp mfschunkserver.cfg.dist mfschunkserver.cfg
[[email protected] etc]# cp mfshdd.cfg.dist mfshdd.cfg
[[email protected] etc]#
[[email protected] var]# mkdir -p /var/bak/mfschunk01
[[email protected] var]# chown -R mfs:mfs /var/bak/mfschunk01/
[[email protected] var]# vi /etc/mfshdd.cfg
# mount points of HDD drives
#
#/mnt/hd1
#/mnt/hd2
#etc.
/var/bak/mfschunk01/
[[email protected] mfschunk02]# vi /etc/mfschunkserver.cfg
WORKING_USER = mfs
WORKING_GROUP = mfs
MASTER_HOST = mfsmaster
MASTER_PORT = 9420
MASTER_TIMEOUT = 60
#去掉上面5行前的注释
~
[[email protected] var]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#192.168.0.180 magicdb.com
192.168.0.180 mfsmaster
4,启动服务:
[[email protected] var]# /usr/local/mfs/sbin/mfschunkserver start
working directory: /var/lib/mfs
lockfile created and locked
initializing mfschunkserver modules ...
hdd space manager: scanning folder /var/bak/mfschunk01/ ...
hdd space manager: /var/bak/mfschunk01/: 0 chunks found
hdd space manager: scanning complete
main server module: listen on *:9422
no charts data file - initializing empty charts
mfschunkserver daemon initialized properly
注:重复上面步骤安装Chunk Server 2,有以下2个需要注意的地方:
mkdir -p /var/bak/mfschunk02/
[[email protected] var]# vi /etc/mfshdd.cfg
# mount points of HDD drives
#
#/mnt/hd1
#/mnt/hd2
#etc.
/var/bak/mfschunk02/
五,Client 安装及配置:
1,安装FUSE:
[[email protected] local]# tar -zxvf fuse-2.7.4.tar.gz
[[email protected] local]# cd fuse-2.7.4
[[email protected] fuse-2.7.4]# ./configure
[[email protected] fuse-2.7.4]# make && make install
2,编译及安装:
[[email protected] local]# cd mfs-1.6.17
./configure --prefix=/usr/local/mfs --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --enable-mfsmount --disable-mfsmaster --disable-mfschunkserver
[[email protected] mfs-1.6.17]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
3,连接mfsmaster服务器:
[[email protected] opt]# /usr/local/mfs/bin/mfsmount /mnt/mfs/ -H mfsmaster
mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root
[[email protected] ~]# df -h | grep mfs
mfs#mfsmaster:9421 157G 529M 156G 1% /mnt/mfs
4,设置文件副本数量为3:
[[email protected] opt]# /usr/local/mfs/bin/mfsrsetgoal 3 /mnt/mfs
deprecated tool - use "mfssetgoal -r"
/mnt/mfs:
inodes with goal changed: 5
inodes with goal not changed: 0
inodes with permission denied: 0
[[email protected] opt]#
5,复制一个文件到/mnt/mfs目录中,并查看副本数量:
[[email protected] mfs]# /usr/local/mfs/bin/mfsgetgoal /mnt/mfs/mfs-1.6.17.tar.gz
/mnt/mfs/mfs-1.6.17.tar.gz: 3
未完待续