MFS works
Distributed Principle
Distributed File System is to some shared files across multiple computers folder, the set time to a shared folder, users want to access these folders, just open a folder, you can see all Link to this shared folder within a folder.
MFS principle
MFS is a fault-tolerant network distributed file system, which is stored in the data dispersed across multiple physical servers, and it is presented to the user in a unified resource.
MFS composition
• metadata server (Master): responsible for managing the file system in the whole system, maintain metadata, currently does not support high availability.
• Metadata log server (MetaLogger): Master backup server's log files change, when the master server is damaged, can be obtained from the log file recovery server.
• Data Storage Server (Chunk Server): The more real storage data server, the server, the greater the capacity, higher reliability, better performance.
• Client (Client): can be as NFS mount the same mount MFS file system
Processing the read data MFS
• The client issues a read request to the server metadata
• Metadata server the required data storage location (Chunk Server IP address and Chunk number) tells the client
• The client requests to known Chunk Server sends data
• Chunk Server to The client sends data
The process of writing
• the client to the server sends metadata write request
• The metadata server interact with Chunk Server, but only the metadata server to create a new block Chunks in some server, create a metadata server operating successfully informed by the success Servers Hunk
• metadata server tells the client, which can write data which Chunks Chunk server in a
• client data is written to the specified Chunk server
• the Chunk server data synchronization with other Chunk server, after a successful synchronization Chunk server tells the client data write successfully
• inform the client metadata server for this change is completed
lab environment:
master:192.168.45.133
masterlogger:192.168.45.130
chunk1:192.168.45.136
chunk2:192.168.45.134
client:192.168.45.135
Experiment set up
master 192.168.45.133
#关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
#安装组件
[root@localhost ~]# yum install zlib-devel gcc gcc-c++ -y
#挂载mfs必要软件包
[root@localhost ~]# mount.cifs //192.168.100.3/lzp /mnt
Password for root@//192.168.100.3/lzp:
[root@localhost ~]# cd /mnt/mfs
#解压安装包
[root@localhost mfs]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[root@localhost mfs]# cd /opt/mfs-1.6.27/
[root@localhost mfs-1.6.27]# useradd -s /sbin/nologin mfs
[root@localhost mfs-1.6.27]# ./configure \
--prefix=/usr/local/mfs \ //指定安装目录
--with-default-user=mfs \ //指定程序运行用户
--with-default-group=mfs \ //指定程序运行组
--disable-mfschunkserver \ //禁用Chunk功能
--disable-mfsmount //禁用mfsmount功能
[root@localhost mfs-1.6.27]# make && make install
#复制文件,配置mfs文件
[root@localhost mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/
[root@localhost mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg
#权限
[root@localhost mfs]# cp mfsexports.cfg.dist mfsexports.cfg
#日志
[root@localhost mfs]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
[root@localhost mfs]# cd /usr/local/mfs/var/mfs/
[root@localhost mfs]# cp metadata.mfs.empty metadata.mfs
#修改权限并启动
[root@localhost mfs]# chown -R mfs.mfs /usr/local/mfs
[root@localhost mfs]# /usr/local/mfs/sbin/mfsmaster start
#查看mfs端口是否开启
[root@localhost mfs]# ps -ef | grep mfs
#启动监控,在所有全部搭建好之后再启动
[root@localhost mfs]# /usr/local/mfs/sbin/mfscgiserv
After viewing build a good view on a port of
log log 192.168.45.130
#关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
#安装必要组件
[root@localhost ~]# yum install zlib-devel gcc gcc-c++ -y
#创建用户
[root@localhost ~]# useradd mfs -s /sbin/nologin
#挂载软件包
[root@localhost ~]# mount.cifs //192.168.100.3/lzp /mnt
[root@localhost ~]# cd /mnt/mfs
#解压安装包
[root@localhost mfs]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[root@localhost mfs]# 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 mfsmetalogger.cfg.dist mfsmetalogger.cfg
[root@localhost mfs]# vim mfsmetalogger.cfg
#在第15行开启功能,然后地址指向master服务器地址
MASTER_HOST = 192.168.45.133
#修改权限并启动
[root@localhost mfs]# chown -R mfs.mfs /usr/local/mfs/
[root@localhost mfs]# /usr/local/mfs/sbin/mfsmetalogger start
Check port status on the
Storage node 192.168.45.136
root@localhost ~]# yum install zlib-devel gcc gcc-c++ -y
[root@localhost ~]# useradd -s /sbin/nologin mfs
[root@localhost ~]# mount.cifs //192.168.100.3/lzp /mnt
[root@localhost ~]# cd /mnt/mfs
#解压安装包
[root@localhost mfs]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[root@localhost mfs]# 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
#修改,在第12行,开启,并将地址指向master地址
[root@localhost mfs]# vim mfschunkserver.cfg
MASTER_HOST = 192.168.45.133
#设置挂载目录
[root@localhost mfs]# vim mfshdd.cfg
/data
[root@localhost mfs]# mkdir /data
[root@localhost mfs]# chown -R mfs:mfs /data
[root@localhost mfs]# /usr/local/mfs/sbin/mfschunkserver start
Check port status on the
Storage node 192.168.45.134
[root@localhost ~]# yum install zlib-devel gcc gcc-c++ -y
[root@localhost ~]# useradd -s /sbin/nologin mfs
[root@localhost ~]# mount.cifs //192.168.100.3/lzp /mnt
[root@localhost ~]# cd /mnt/mfs
#解压安装包
[root@localhost mfs]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[root@localhost mfs]# 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
MASTER_HOST = 192.168.45.133
[root@localhost mfs]# vim mfshdd.cfg
/data
[root@localhost mfs]# mkdir /data
[root@localhost mfs]# chown -R mfs:mfs /data
[root@localhost mfs]# /usr/local/mfs/sbin/mfschunkserver start
Check port status on the
Client 192.168.45.135
# 关闭防火墙
[root@manager ~]# systemctl stop firewalld.service
[root@manager ~]# setenforce 0
#安装必要组件
[root@manager ~]# yum install gcc gcc-c++ zlib-devel -y
#挂载软件包
[root@manager ~]# mount.cifs //192.168.100.3/lzp /mnt
[root@manager ~]# cd /mnt/mfs/
#解压软件包
[root@manager mfs]# tar zxvf fuse-2.9.2.tar.gz -C /opt
#编译安装
[root@manager mfs]# cd /opt/fuse-2.9.2/
[root@manager fuse-2.9.2]# ./configure
[root@manager fuse-2.9.2]# make && make install
#修改系统文件
[root@manager fuse-2.9.2]# vim /etc/profile
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
#重新加载
[root@manager fuse-2.9.2]# source /etc/profile
#创建用户
[root@manager fuse-2.9.2]# useradd -s /sbin/nologin mfs
#解压安装包
[root@manager fuse-2.9.2]# cd /mnt/mfs/
[root@manager mfs]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
#编译安装
[root@manager mfs]# cd /opt/mfs-1.6.27/
[root@manager mfs-1.6.27]# ./configure \
--prefix=/usr/local/mfs \
--with-default-user=mfs \
--with-default-group=mfs \
--disable-mfsmaster \
--disable-mfschunkserver \
--enable-mfsmount
[root@manager mfs-1.6.27]# make && make install
#创建挂载点
[root@manager mfs-1.6.27]# mkdir /opt/mfs
[root@manager mfs-1.6.27]# modprobe fuse
#挂载
[root@manager mfs-1.6.27]# /usr/local//mfs/bin/mfsmount /opt/mfs -H 192.168.45.133
# 优化客户端
[root@manager mfs-1.6.27]# vim /etc/profile
export PATH=/usr/local/mfs/bin:$PATH
[root@manager mfs-1.6.27]# source /etc/profile
# 备份
[root@manager mfs-1.6.27]# mfsgetgoal -r /opt/mfs/
Mount View
Check distributed pattern
Access http://192.168.45.133:9425 browser