Enterprise Practical--MFS Network Distributed File system

Source: Internet
Author: User

-----------------------MFS----------------------
(1) Distributed principle

Distributed File System (distributed) means that the physical storage resources managed by the file system are not necessarily directly connected to the local nodes, but are connected to the nodes through the computer network. To put it simply, a shared folder (a virtual shared folder) is set up in a folder that is distributed across all the computers in the LAN. For users, to access these shared folders, simply open the virtual shared folder and see all the shared folders that are linked to the virtual shared folder, and users don't feel the shared files
are scattered across computers. The benefits of distributed file systems are centralized access, simplified operations, data disaster recovery, and improved file access performance.

(2) MFS principle

MFS is a fault-tolerant network Distributed file system that stores data in multiple physical services
is a unified resource that is presented to the user.
> 1) The composition of the MFS file system.

    • Meta Data server ( Master): A standalone host that manages the entire file system, managing the file system and maintaining metadata throughout the system. (File size, properties, location information, including all information about all unconventional files, such as directories, sockets, pipelines, and device files)
    • Metadata Log server ( Metalogger): Backs up the change log file for the master server with a file type of Changelog ml. *mfs when the master server data is lost or corrupted, files can be obtained from the log server for recovery.
    • Data Storage server ( Chunkserver): A server that truly stores data. When the file is stored, the files are saved in chunks and replicated between the data servers. The more data servers, the greater the capacity you can use, the higher the reliability, and the better the performance.
    • Client: The MFS file system can be mounted as if it were mounted on NFS, and the operation is the same.
      > MFS file system composition structure.

2) The processing process of MFS reading data

    • The client sends a read request to the metadata server.
    • The metadata server informs the client of the location where the required data is stored (Chunk server's P address and Chunk number).
    • The client sends data to a known Chunk server request
    • Chunk server sends data to the client.

3) The processing process of MFS writing data

    • Client sends write requests to the metadata server
    • The metadata server interacts with Chunk server (this interaction only occurs when the required chunked chunks exist), but the metadata server creates a new chunked chunks only on some servers, which the Chunk servers tells the metadata server operation to succeed after the creation succeeds.
    • The metadata server informs the client which chunks of the Chunk server can write to the data.
    • The client writes data to the specified Chunk server.
    • The Chunk server synchronizes data with other Chunk servers and Chunkserver tells the client that the data was successfully written after the synchronization is successful
    • The client informs the metadata server that this write is complete
---------------------Case Study----------------------

Overview
The company's previous picture Server is NFS, and as the volume of traffic increases, multiple servers share a server's storage space by NFS, which makes the NFSS server overwhelmed and often has a timeout problem. and there is a single point of failure for NFS, although it is possible for rsync to synchronize data to another server to do a backup of NFS services, but this is not helpful for improving the performance of the entire system. Based on current requirements, we need to optimize or take other solutions for NFS servers, but optimization does not address the performance requirements of an increasing number of clients, so the solution chosen is to use a distributed file system. With Distributed file systems, data access between servers is no longer a one-to-many relationship, but a many-to-many relationship, which can greatly improve performance.
In the current many commonly used distributed file systems, we use the MFS (moosefs).
>[need to note: MFS masterserver management node only one, there may be a single point of failure, follow-up I will write a solution Fastdfs "

Although MFS has the possibility of a single point of failure, but there are many better features such as:
1. High reliability (multiple copies of the data are stored on different computers)
2. Capacity can be dynamically expanded by attaching new computers or hard drives
3. Deleted files can be retained according to a configurable time period (a file system-level Recycle Bin)
4. Consistent snapshot of files that are not affected by access and write

MFS officially launched in May 2008, it is a fault-tolerant, highly available, scalable massive scale Distributed file system . MFS scattered data across multiple servers, but the user sees only one source. MFS, like other class Unx file systems, contains hierarchy and file attributes that can create special files (block devices, character devices, pipelines, sockets), symbolic links, and hard links.

Lab Environment: tr>
host operating system IP address Software Installation
Master Server CentOS 7 192.168.233.128 mfs-1.6.27-5.tar.gz
metalogger Server CentOS 7 192.168.233.6 mfs-1.6.27-5.tar.gz
Chunk Server 1 CentOS 7 192.168.233.4 mfs-1.6.27-5.tar.gz
Chunk Server 2 CentOS 7 192.168.233.10 mfs-1.6.27-5.tar.gz
Client CentOS 7 192.168.233.11 mfs-1.6.27-5.tar.gz fuse-2.9.2.tar.gz
Package Baidu Network Disk
Mfs-1.6.27-5.tar.gz Link: https://pan.baidu.com/s/1-l0ZEisWmlGT2aNqR2nGaw Password: e98v
Fuse-2.9.2.tar.gz Link: https://pan.baidu.com/s/1rZPOnsVISzu0Z0aucr7J7g Password: 71si
One, Master server and Metalogger server common steps:

1. Turn off the firewall

#关闭防火墙systemctl stop firewalld.service setenforce 0

2. Installation Environment

yum install gcc gcc-c++ zlib-devel -y

3. Create a MFS program user

useradd -s /sbin/nologin mfs

4. Unzip the MFS file

tar zxvf mfs-1.6.27-5.tar.gz -C /opt

5. Installation settings

cd /opt/mfs-1.6.27/
./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount

6. Compiling the installation

make && make install

7. Copying metadata Files

cd /usr/local/mfs/var/mfs/cp metadata.mfs.empty metadata.mfs
Next is a separate operation for master server and Metalogger server
Second, Master server operations

1. Copy the configuration template to turn on the feature

cd /usr/local/mfs/etc/mfs/
[[email protected] mfs]# cp mfsexports.cfg.dist mfsexports.cfg       #权限配置文件[[email protected] mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg            #master配置文件[[email protected] mfs]# cp mfstopology.cfg.dist mfstopology.cfg           #本服务器的日志文件

2. Start the primary Server service:

/usr/local/mfs/sbin/mfsmaster start

3. Check if the Mfsmaster service is turned on

ps -ef | grep mfs

Third, Metalogger server operation

1. Copy the configuration template to turn on the feature

cd /usr/local/mfs/etc/mfs/
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

2. Modifying the MFS Log service configuration file

[[email protected] mfs]# vim mfsmetalogger.cfg
....以上内容忽略MASTER_HOST = 192.168.233.128         #修改并指向Master Server的地址#MASTER_PORT = 9419....以下内容忽略修改完成后保存退出

3. Start the Metalogger Server Server service

/usr/local/mfs/sbin/mfsmetalogger start

4. Check if the service is turned on

[[email protected] mfs]# ps -ef | grep mfs

Log Server service turned on

Need to note:
The default is 24 hours, which is to download a metadata.mfs.back file from the Meta data server master every other day.
When the metadata server shuts down or fails, the Matedata.mfs.back file disappears,
Then to restore the entire MFS, you need to get the file from the Metalogger server.
Please pay particular attention to this file, which, together with the log files, will restore the entire corrupted Distributed file system.

Iv. Chunk Server 1 and 2 co-operate

1. Installation Environment

yum install gcc gcc-c++ zlib-devel -y

2. Create a MFS program user

useradd -s /sbin/nologin mfs

3. Unzip the file

tar zxvf mfs-1.6.27-5.tar.gz -C /opt

4. Installation settings

cd /opt/mfs-1.6.27/
./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster --disable-mfsmount

5. Compiling the installation

make && make install

6. Copy the configuration template to turn on the feature

cd /usr/local/mfs/etc/mfs/cp mfschunkserver.cfg.dist mfschunkserver.cfgcp mfshdd.cfg.dist mfshdd.cfg

7. Modify the Mfschunk configuration file

vim mfschunkserver.cfg
....以上内容忽略#BIND_HOST = *MASTER_HOST = 192.168.233.128                        #修改并指向Master Server的地址#MASTER_PORT = 9420....以下内容忽略修改完成后保存退出

8. Modify the configuration file

vim mfshdd.cfg
....以上内容忽略#/mnt/hd1#/mnt/hd2#etc./data                             #添加文件目录~            修改完成后保存退出

9. Create a file directory and change the owner group

mkdir /datachown -R mfs.mfs /data

10. Turn on the service

/usr/local/mfs/sbin/mfschunkserver start

11. View service Open

ps -ef | grep mfs

V. Client operation

1. Turn off the firewall

systemctl stop firewalld.service setenforce 0

2. Installation Environment

yum install gcc gcc-c++ zlib-devel -y

3. Unzip Fuse

tar zxvf fuse-2.9.2.tar.gz -C /opt/

4. Compiling the installation

cd /opt/fuse-2.9.2/
./configure
make && make install

5. Editing Environment variables

vim  /etc/profile
#在末尾插入一行:export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH添加完成后保存退出
source /etc/profile

6. Installing MFS

useradd -s /sbin/nologin mfs              #创建mfs程序用户
tar zxvf mfs-1.6.27-5.tar.gz -C /opt              #解压缩文件

7. Compiling and installing MFS

cd /opt/mfs-1.6.27/
./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster --disable-mfschunkserver --enable-mfsmount
make && make install

8. Load the fuse core

mkdir /opt/mfs         #创建挂载目录
modprobe fuse           #加载fuse内核
/usr/local/mfs/bin/mfsmount /opt/mfs -H 192.168.233.128               #Master Server挂载到客户端

PS: Optimizing Client Operations

Client Operation:
1. In order to be able to directly use Mfsmount This command, the environment variable modification.
To edit an environment variable:

vim /etc/profile
#末尾插入一行:export PATH=/usr/local/mfs/bin:$PATH添加完成后保存退出

-----------Start the Monitoring program on master server-----------

Start monitoring:

/usr/local/mfs/sbin/mfscgiserv

Enter the master server address to enter the monitoring
http://192.168.233.128:9425

Enterprise Practical--MFS Network Distributed File system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.