简介: MooseFS是一个具有容错性的网络分布式文件系统。它把数据分散存放在多个物理服务器上,而呈现给用户的则是一个统一的资源。 常规特征: 1、分层次的结构(目录树) 2、存储POSIX文件属性(权限、最后访问和修改时间) 3、支持特殊文件(块和字符设备、管道以及套接字) 4、符号连接和硬连接 5、对文件系统的访问可以通过IP地址和(或者)密码进行限制 独有特征: 1、高可靠(数据的多个拷贝被存储在不同的计算机上) 2、通过附加新的计算机或者硬盘可以实现容量的动态扩展 3、删除的文件可以根据一个可配置的时间周期进行保留(一个文件系统级别的回收站) 4、不受访问和写入影响的文件连贯快照 实验环境及安装包: mfs1.6安装包: 链接:https://pan.baidu.com/s/1hWqTj6BnQUzW89eBtcBdEg 提取码:vaog fuse2.9安装包: 链接:https://pan.baidu.com/s/1Su-Va9M3m0melIXTINcc4w 提取码:dyva

第一台服务器master 192.168.120.133 第二台服务器log 192.168.120.128 第三台服务器chunk01 192.168.120.129 第四台服务器chunk02 192.168.120.131 第五台服务器client 192.168.120.132 具体实验操作:(实验步骤虽然多,但前面都是重复操作) ---------------------------搭建Master服务器--------------------------- [root@localhost ~]# yum install gcc gcc-c++ zlib-devel -y [root@localhost ~]# useradd -s /sbin/nologin mfs [root@localhost ~]# mkdir /abc [root@localhost ~]# mount.cifs //192.168.100.10/rhel6 /abc Password for root@//192.168.100.10/rhel6:
[root@localhost ~]# cd /abc/Y2C [root@localhost Y2C]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt/ [root@localhost Y2C]# cd /opt/mfs-1.6.27/ [root@localhost mfs-1.6.27]# ./configure
--prefix=/usr/local/mfs
--with-default-user=mfs
--with-default-group=mfs
--disable-mfschunkserver
--disable-mfsmount [root@localhost mfs-1.6.27]# make && make install [root@localhost mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/ [root@localhost mfs]# ls mfsexports.cfg.dist mfsmaster.cfg.dist mfsmetalogger.cfg.dist mfstopology.cfg.dist [root@localhost mfs]# cp mfsexports.cfg.dist mfsexports.cfg [root@localhost mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg [root@localhost mfs]# cp mfstopology.cfg.dist mfstopology.cfg [root@localhost mfs]# cd /usr/local/mfs/var/mfs/ [root@localhost mfs]# cp metadata.mfs.empty metadata.mfs [root@localhost mfs]# /usr/local/mfs/sbin/mfsmaster start [root@localhost mfs]# systemctl stop firewalld.service [root@localhost mfs]# setenforce 0 [root@localhost mfs]# netstat -ntap | grep mfsmaster tcp 0 0 0.0.0.0:9419 0.0.0.0:* LISTEN 12020/mfsmaster
tcp 0 0 0.0.0.0:9420 0.0.0.0:* LISTEN 12020/mfsmaster
tcp 0 0 0.0.0.0:9421 0.0.0.0:* LISTEN 12020/mfsmaster

------------------搭建MetaLogger server-------------------

---------------第二台服务器上(日志配置)------------------- [root@localhost ~]# yum install gcc gcc-c++ zlib-devel -y [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# setenforce 0 [root@localhost ~]# useradd -s /sbin/nologin mfs [root@localhost ~]# mkdir /abc [root@localhost ~]# mount.cifs //192.168.100.10/rhel6 /abc Password for root@//192.168.100.10/rhel6: [root@localhost ~]# cd /abc/Y2C/ [root@localhost Y2C]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt/ [root@localhost Y2C]# cd /opt/mfs-1.6.27/ [root@localhost mfs-1.6.27]# ./configure
--prefix=/usr/local/mfs
--with-default-user=mfs
--with-default-group=mfs
--disable-mfschunkserver
--disable-mfsmount [root@localhost mfs-1.6.27]# make && make install [root@localhost mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/ [root@localhost mfs]# cp mfsexports.cfg.dist mfsexports.cfg [root@localhost mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg [root@localhost mfs]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg [root@localhost mfs]# vim mfsmetalogger.cfg #第15行 MASTER_HOST = 192.168.120.133 #(IP为第一台主服务器的) [root@localhost mfs]# cd /usr/local/mfs/var/mfs/ [root@localhost mfs]# cp metadata.mfs.empty metadata.mfs [root@localhost mfs]# /usr/local/mfs/sbin/mfsmetalogger start working directory: /usr/local/mfs/var/mfs

----------------第三、四台(节点服务器1、2)两台同样操作----------------------- [root@localhost ~]# yum install gcc gcc-c++ zlib-devel -y [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# setenforce 0 [root@localhost ~]# useradd -s /sbin/nologin mfs [root@localhost ~]# mkdir /abc [root@localhost ~]# mount.cifs //192.168.100.10/rhel6 /abc Password for root@//192.168.100.10/rhel6:
[root@localhost ~]# cd /abc/Y2C [root@localhost Y2C]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt/ [root@localhost Y2C]# cd /opt/mfs-1.6.27/ [root@localhost mfs-1.6.27]# ./configure
--prefix=/usr/local/mfs
--with-default-user=mfs
--with-default-group=mfs
--disable-mfsmaster
--disable-mfsmount [root@localhost mfs-1.6.27]# make && make install [root@localhost mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/ [root@localhost mfs]# cp mfschunkserver.cfg.dist mfschunkserver.cfg [root@localhost mfs]# cp mfshdd.cfg.dist mfshdd.cfg [root@localhost mfs]# vim mfschunkserver.cfg

第12行 MASTER_HOST = 192.168.120.133

[root@localhost mfs]# vim mfshdd.cfg #按G到末尾插入路径 /data

[root@localhost mfs]# mkdir /data [root@localhost mfs]# chown -R mfs.mfs /data/ [root@localhost mfs]# /usr/local/mfs/sbin/mfschunkserver start [root@localhost mfs]# netstat -ntap | grep mfschunkserve tcp 0 0 0.0.0.0:9422 0.0.0.0:* LISTEN 44065/mfschunkserve tcp 0 0 192.168.120.129:35272 192.168.120.133:9420 ESTABLISHED 44065/mfschunkserve

-------------------------------客户端---------------------------------------------- [root@localhost ~]# yum install gcc gcc-c++ zlib-devel -y [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# setenforce 0 [root@localhost ~]# useradd -s /sbin/nologin mfs [root@localhost ~]# mkdir /abc [root@localhost ~]# mount.cifs //192.168.100.10/rhel6 /abc Password for root@//192.168.100.10/rhel6:
[root@localhost ~]# cd /abc/Y2C [root@localhost Y2C]# tar zxvf fuse-2.9.2.tar.gz -C /opt/ [root@localhost Y2C]# cd /opt/fuse-2.9.2/ [root@localhost fuse-2.9.2]# ./configure [root@localhost fuse-2.9.2]# make && make install [root@localhost fuse-2.9.2]# vim /etc/profile 按G到末尾插入 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

[root@localhost fuse-2.9.2]# source /etc/profile [root@localhost fuse-2.9.2]# cd /abc/Y2C/ [root@localhost Y2C]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt/ [root@localhost Y2C]# cd /opt/mfs-1.6.27/ [root@localhost mfs-1.6.27]# ./configure
--prefix=/usr/local/mfs
--with-default-user=mfs
--with-default-group=mfs
--disable-mfsmaster
--disable-mfschunkserver
--enable-mfsmount

[root@localhost mfs-1.6.27]# make && make install [root@localhost mfs-1.6.27]# mkdir /opt/mfs [root@localhost mfs-1.6.27]# modprobe fuse #加载fuse模块到内核 [root@localhost mfs-1.6.27]# /usr/local/mfs/bin/mfsmount /opt/mfs -H 192.168.120.133 mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root [root@localhost mfs-1.6.27]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 20G 3.6G 17G 18% / devtmpfs 897M 0 897M 0% /dev tmpfs 912M 0 912M 0% /dev/shm tmpfs 912M 9.1M 903M 1% /run tmpfs 912M 0 912M 0% /sys/fs/cgroup /dev/mapper/centos-opt 5.0G 76M 5.0G 2% /opt /dev/mapper/centos-home 10G 37M 10G 1% /home /dev/sda1 1012M 179M 834M 18% /boot tmpfs 183M 4.0K 183M 1% /run/user/42 tmpfs 183M 20K 183M 1% /run/user/0 /dev/sr0 4.3G 4.3G 0 100% /run/media/root/CentOS 7 x86_64 //192.168.100.10/rhel6 311G 227G 85G 73% /abc 192.168.120.133:9421 32G 0 32G 0% /opt/mfs ###挂载过来了

------------------优化客户端-------------------------------

[root@localhost mfs-1.6.27]# vim /etc/profile export PATH=/usr/local/mfs/bin:$PATH

[root@localhost mfs-1.6.27]# source /etc/profile [root@localhost mfs-1.6.27]# cd /opt/mfs [root@localhost mfs]# echo "this is abc" > test.txt [root@localhost mfs]# mfsgetgoal -r 2 /opt/mfs #复制两份文件

-------------MASTER-server---------------启动监控程序------ [root@localhost mfs]# /usr/local/mfs/sbin/mfscgiserv lockfile created and locked starting simple cgi server (host: any , port: 9425 , rootpath: /usr/local/mfs/share/mfscgi) ----------------打开浏览器访问------------------------- 访问主服务器:http://192.168.120.133:9425 #两个节点: #客户端: #存储位置: