据说MFS是最简单的分布式系统,因此测试一下。
主控服务器一键安装:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
yum install gcc gcc-c++ vim wget openssl openssl-devel libpcap libpcap-devel fuse fuse-devel zlib zlib-devel -y mkdir /byrd/{tools,service} -p cd /byrd/tools wget http://ppa.moosefs.com/src/moosefs-2.0.89-1.tar.gz tar -zxf moosefs-2.0.89-1.tar.gz cd moosefs-2.0.89 groupadd mfs useradd -g mfs mfs -s /sbin/nologin ./configure --prefix=/byrd/service/moosefs-2.0.89 --mandir=/usr/share/man --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount make && make install ln -s /byrd/service/moosefs-2.0.89 /usr/local/mfs cd /usr/local/mfs/etc/mfs cp mfsmaster.cfg.dist mfsmaster.cfg cp mfstopology.cfg.dist mfstopology.cfg cat >mfsexports.cfg <<EOF # Allow "meta". * . rw # Allow everything but "meta". 1.1.1.0/24 / rw,alldirs,mapall=mfs:mfs,password=111111 EOF cd ../../var/mfs/ mv metadata.mfs.empty metadata.mfs ../../sbin/mfsmaster start |
主控服务器实操过程:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[root@MFS-M ~]# echo "127.0.0.1 mfsmaster">>/etc/hosts [root@MFS-M ~]# yum install gcc gcc-c++ vim wget openssl openssl-devel libpcap libpcap-devel fuse fuse-devel zlib zlib-devel [root@MFS-M ~]# mkdir /byrd/tools -p [root@MFS-M tools]# wget http://ppa.moosefs.com/src/moosefs-2.0.89-1.tar.gz [root@MFS-M tools]# tar -zxf moosefs-2.0.89-1.tar.gz [root@MFS-M tools]# cd moosefs-2.0.89 [root@MFS-M moosefs-2.0.89]# groupadd mfs [root@MFS-M moosefs-2.0.89]# useradd -g mfs mfs -s /sbin/nologin [root@MFS-M moosefs-2.0.89]# ./configure --prefix=/byrd/service/moosefs-2.0.89 --mandir=/usr/share/man --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount [root@MFS-M moosefs-2.0.89]# make && make install [root@MFS-M moosefs-2.0.89]# ln -s /byrd/service/moosefs-2.0.89 /usr/local/mfs [root@MFS-M moosefs-2.0.89]# cd /usr/local/mfs/etc/mfs [root@MFS-M mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg [root@MFS-M mfs]# cp mfstopology.cfg.dist mfstopology.cfg [root@MFS-M mfs]# cat >mfsexports.cfg <<EOF > # Allow "meta". > * . rw > # Allow everything but "meta". > 1.1.1.0/24 / rw,alldirs,mapall=mfs:mfs,password=111111 > EOF [root@MFS-M mfs]# cd ../../var/mfs/ [root@MFS-M mfs]# pwd /usr/local/mfs/var/mfs [root@MFS-M mfs]# mv metadata.mfs.empty metadata.mfs [root@MFS-M mfs]# ../../sbin/mfsmaster start [root@MFS-M mfs]# netstat -tunlp|grep 94* tcp 0 0 0.0.0.0:9419 0.0.0.0:* LISTEN 34579/../../sbin/mf tcp 0 0 0.0.0.0:9420 0.0.0.0:* LISTEN 34579/../../sbin/mf tcp 0 0 0.0.0.0:9421 0.0.0.0:* LISTEN 34579/../../sbin/mf [root@MFS-M mfs]# ../../sbin/mfscgiserv start |
主、备区别:
0 1 2 3 4 5 6 7 8 9 |
[root@MFS-B moosefs-2.0.89]# cd /usr/local/mfs/etc/mfs/ [root@MFS-B mfs]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg [root@MFS-B mfs]# echo "1.1.1.70 mfsmaster" >> /etc/hosts [root@MFS-B mfs]# echo "MASTER_HOST = mfsmaster.t4x.org" >> mfsmetalogger.cfg [root@MFS-B mfs]# echo "1.1.1.70 mfsmaster.t4x.org" >> /etc/hosts [root@MFS-B mfs]# ps aux | grep mfs mfs 6859 0.7 0.2 17628 1156 ? S< 17:15 0:00 /usr/local/mfs/sbin/mfsmetalogger start [root@MFS-B mfs]# netstat -an | grep -i est Active Internet connections (servers and established) tcp 0 0 1.1.1.71:48728 1.1.1.70:9419 ESTABLISHED |
主、备、chunk区别:
0 1 2 3 4 5 6 7 8 9 |
[root@MFS-chunk01 moosefs-2.0.89]# ./configure --prefix=/byrd/service/moosefs-2.0.89 --mandir=/usr/share/man --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster [root@MFS-chunk01 mfs]# cp mfschunkserver.cfg.dist mfschunkserver.cfg [root@MFS-chunk01 mfs]# cp mfshdd.cfg.dist mfshdd.cfg [root@MFS-chunk01 mfs]# echo "MASTER_HOST = mfsmaster.t4x.org" >>mfschunkserver.cfg [root@MFS-chunk01 mfs]# echo "1.1.1.70 mfsmaster.t4x.org" >> /etc/hosts [root@MFS-chunk01 mfs]# echo "/mfsdata" >>mfshdd.cfg [root@MFS-chunk01 mfs]# chown mfs.mfs /mfsdata/ [root@MFS-chunk01 mfs]# /usr/local/mfs/sbin/mfschunkserver start [root@MFS-chunk01 mfs]# netstat -tunlp|grep 94 tcp 0 0 0.0.0.0:9422 0.0.0.0:* LISTEN 6980/mfschunkserver |
主、备、chunk、client区别:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
[root@MFS-WEB moosefs-2.0.89]# ./configure --prefix=/byrd/service/moosefs-2.0.89 --mandir=/usr/share/man --with-default-user=mfs --wis --with-default-group=mfs --disable-mfschunkserver ##--enable-mfsmount不需要,以及没有这个参数## [root@MFS-WEB moosefs-2.0.89]# chown -R mfs.mfs /usr/local/nginx/html/wp-content/uploads/ #以wordpress图片目录为例 [root@MFS-WEB moosefs-2.0.89]# lsmod | grep fuse [root@MFS-WEB moosefs-2.0.89]# modprobe fuse #加入内核,加入rc.local [root@MFS-WEB moosefs-2.0.89]# lsmod | grep fuse fuse 79892 0 [root@MFS-WEB moosefs-2.0.89]# echo "1.1.1.70 mfsmaster.t4x.org" >> /etc/hosts [root@MFS-WEB moosefs-2.0.89]# /usr/local/mfs/bin/mfsmount /usr/local/nginx/html/wp-content/uploads -H mfsmaster.t4x.org mfsmaster register error: Password is needed [root@MFS-WEB moosefs-2.0.89]# /usr/local/mfs/bin/mfsmount /usr/local/nginx/html/wp-content/uploads -H mfsmaster.t4x.org mfsmaster register error: Password is needed [root@MFS-WEB moosefs-2.0.89]# /usr/local/mfs/bin/mfsmount /usr/local/nginx/html/wp-content/uploads -H mfsmaster.t4x.org -o mfspassword=111111 mfsmaster accepted connection with parameters: read-write,restricted_ip,map_all ; root mapped to www:www ; users mapped to www:www fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option error in fuse_mount [root@MFS-WEB moosefs-2.0.89]# /usr/local/mfs/bin/mfsmount /usr/local/nginx/html/wp-content/uploads -H mfsmaster.t4x.org -o mfspassword=111111 mfsmaster accepted connection with parameters: read-write,restricted_ip,map_all ; root mapped to www:www ; users mapped to www:www /usr/local/mfs/bin/mfsmount /usr/local/nginx/html/wp-content/uploads -H mfsmaster.t4x.org -o mfspassword=111111 -o nonempty -o fsname=mfs [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfsfileinfo passwd passwd: chunk 0: 000000000000017A_00000001 / (id:378 ver:1) copy 1: 1.1.1.74:9422 [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfssetgoal -r 3 /usr/local/nginx/html/wp-content/uploads/ /usr/local/nginx/html/wp-content/uploads/: inodes with goal changed: 1 inodes with goal not changed: 230 inodes with permission denied: 1 #没有找到为何拒绝的原因 [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfsgetgoal passwd passwd: 3 [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfsfileinfo passwd passwd: chunk 0: 000000000000017A_00000001 / (id:378 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.74:9422 [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfsfileinfo passwd passwd: chunk 0: 000000000000017A_00000001 / (id:378 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.73:9422 copy 3: 1.1.1.74:9422 [root@MFS-WEB uploads]# /usr/local/mfs/bin/mfssetgoal -r 3 /usr/local/nginx/html/wp-content/uploads/abc/ /usr/local/nginx/html/wp-content/uploads/abc/: inodes with goal changed: 1 inodes with goal not changed: 0 inodes with permission denied: 0 [root@MFS-WEB abc]# dd if=/dev/zero of=/usr/local/nginx/html/wp-content/uploads/abc/10m.img bs=1M count=10 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.501608 s, 20.9 MB/s [root@MFS-WEB abc]# /usr/local/mfs/bin/mfscheckfile 10m.img 10m.img: chunks with 3 copies: 1 [root@MFS-WEB abc]# /usr/local/mfs/bin/mfsfileinfo 10m.img 10m.img: chunk 0: 000000000000017C_00000001 / (id:380 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.73:9422 copy 3: 1.1.1.74:9422 [root@MFS-WEB abc]# dd if=/dev/zero of=/usr/local/nginx/html/wp-content/uploads/abc/55m.img bs=1M count=55 [root@MFS-WEB abc]# /usr/local/mfs/bin/mfsfileinfo 64m.img 64m.img: chunk 0: 0000000000000181_00000001 / (id:385 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.73:9422 copy 3: 1.1.1.74:9422 [root@MFS-WEB abc]# /usr/local/mfs/bin/mfsfileinfo 65m.img 65m.img: chunk 0: 000000000000017F_00000001 / (id:383 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.73:9422 copy 3: 1.1.1.74:9422 chunk 1: 0000000000000180_00000001 / (id:384 ver:1) copy 1: 1.1.1.72:9422 copy 2: 1.1.1.73:9422 copy 3: 1.1.1.74:9422 |
chunk磁盘挂载:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@MFS-chunk moosefs-2.0.89]# fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-261, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): Using default value 261 [root@MFS-chunk01 moosefs-2.0.89]# partprobe [root@MFS-chunk01 moosefs-2.0.89]# mkfs.ext4 /dev/sdb1 [root@MFS-chunk01 moosefs-2.0.89]# mount -a mount: mount point /mfsdata does not exist [root@MFS-chunk01 moosefs-2.0.89]# tail -1 /etc/fstab /dev/sdb1 /mfsdata ext4 defaults 0 0 [root@MFS-chunk01 moosefs-2.0.89]# mkdir /mfsdata [root@MFS-chunk01 moosefs-2.0.89]# mount -a [root@MFS-chunk01 /]# df -h /dev/sdb1 2.0G 35M 1.9G 2% /mfsdata |
MFS下载地址:
2.0:https://moosefs.com/download/sources-archive-2-0.html
3.0:https://moosefs.com/download/sources-archive-3-0.html SourceByrd's Weblog-https://note.t4x.org/service/mfs-master-server-install/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!