Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The principle and Environment Construction of MFS distributed File system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Traditional NFS storage defect analysis: several web servers share a storage through NFS, which can meet the needs in business functions, but in terms of performance and capacity, NFS can not meet the higher requirements. With the increase of business, there is often the problem of timeout, and NFS has a single point of failure. Although rsync can be used to synchronize data to another server for backup, it is not helpful to improve the performance of the whole system. MFS: introduction to distributed file systems:

MFS is a fault-tolerant network distributed file system, which stores data on multiple physical servers and presents users with a unified and integrated resource.

MFS is a fault-tolerant, highly available and scalable sea-scale distributed file system; MFS distributes data on multiple servers, and a single user sees only one source; data access is no longer an one-to-many relationship, but many-to-many, which greatly improves the performance compared with NFS Contains hierarchies and file attributes to create special files (block devices, character devices, pipes, sockets), symbolic links, and hard links. Distributed principle:

Distributed file system (distributed file system) means that the material storage resources managed by the file system are not necessarily directly connected to the local node, but are connected to the node through the computer network. To put it simply, some shared folders distributed on various computers in the local area network are collected into a virtual shared folder, and client access only needs to open this virtual shared folder. you can see all the shared files linked to the virtual shared folder, and the user does not feel that these shared files are scattered on each computer. The advantages of distributed file system are centralized access, simplified operation, data disaster tolerance, and improved file storage performance.

The composition of the MFS file system:

Metadata server (Master): responsible for managing the file system and maintaining metadata throughout the system.

Metadata log server (MetaLogger): back up the change log file of the Master server. The file type is changelog_ml.*.mfs. When the Master server data is lost or corrupted, it can be recovered from the log server. Data storage server (Chunk server): the server that actually stores data. Save the files in blocks and copy each other. Client (Client): the MFS file system can be mounted just like NFS, and the operation is the same. The composition architecture of the MFS file system is shown in the following figure:

The process of MFS reading data: the client sends a read request to the metadata server; the metadata server tells the client where the required data is stored (the IP address and Chunk number of Chunk server). The client sends data to a known Chunk server request. Chunk server sends data to the client. The process of writing data to MFS:

The client sends a write request to the metadata server. The metadata server interacts with Chunk server, but the metadata server only creates a new chunked Chunks on some servers, and after successful creation, the Chunk server informs the metadata server that the operation is successful. The metadata server tells the client which Chunk server and which Chunks the data can be written to. The client writes data to the specified Chunk server. The Chunk server synchronizes data with other Chunk server. After the synchronization is successful, the Chunk server informs the client that the data is written successfully. The client informs the metadata server that the write is complete. The experimental environment introduces the host IP address installation software package operating system Master Server192.168.30.55mfs-1.6.27-5.tar.gzCentOS7MetaLogger Server192.168.30.10mfs-1.6.27-5.tar.gzCentOS7Chunk Server1192.168.30.4mfs-1.6.27-5.tar.gzCentOS7Chunk Server2192.168.30.5mfs-1.6.27-5.tar.gzCentOS7Client192.168.30.6mfs-1.6.27-5.tar.gz Fuse-2.9.2.tar.gzCentOS7 experimental deployment first turn off the firewall on these experimental hosts, selinuxsystemctl stop firewalld.servicesetenforce 0, build the Master Serveryum installation and compilation environment package yum install-y zlib-devel gcc gcc-c++, create and run the user mfsuseradd mfs- s / sbin/nologin install the source code package tar zxvf mfs-1.6.27-5.tar.gz # decompress the source code package cd mfs-1.6. 27/./configure\-- prefix=/usr/local/mfs\ # specify the installation path-- with-default-user=mfs\ # specify the running user Group mfs--with-default-group=mfs\-- disable-mfschunkserver\ # disable node function-- disable-mfsmount # disable mounting make & & make install replication configuration files there are two configuration files needed on Master: mfsmaster.cfg (main configuration file) and mfsexports.cfg (mounted directory and permissions profile) cd / usr/local/mfs/etc/mfs/cp mfsexports.cfg.dist mfsexports.cfgcp mfsmaster.cfg.dist mfsmaster.cfgcp mfsmetalogger .cfg.dist mfsmetalogger.cfgcd / usr/local/mfs/var/mfs/cp metadata.mfs.empty metadata.mfs

You can start work and start Master Server/usr/local/mfs/sbin/mfsmaster start without making any changes to the configuration file

Ps aux | grep mfs

Stop the command / usr/local/mfs/sbin/mfsmaster-s 2 of Master Server, set up MetaLogger Serveryum installation and compilation environment package yum install-y zlib-devel gcc gcc-c++, create and run user mfsuseradd mfs- s/sbin/ nologin installation source code package tar zxvf mfs-1.6.27-5.tar.gz # decompress source code package cd mfs-1.6. 27/./configure\-- prefix=/usr/local/mfs\ # specify the installation path-- with-default-user=mfs\ # specify the running user Group mfs--with-default-group=mfs\-- disable-mfschunkserver\ # disable node function-- disable-mfsmount # disable mounting make & & make install replication configuration file cd / usr/local/mfs/etc/mfs/cp mfsmetalogger.cfg.dist mfsmetalogger.cfg modify configuration file vi mfsmetalogger.cfg.MASTER_HOST = 192.168.30.55.

Start the service / usr/local/mfs/sbin/mfsmetalogger start

Third, set up chunk Server (the service configuration of the two nodes is the same) yum installation and compilation environment package yum install-y zlib-devel gcc gcc-c++ create and run user mfsuseradd mfs- s / sbin/nologin install source code package tar zxvf mfs-1.6.27-5.tar.gz # decompress source code package cd mfs-1.6. 27/./configure\-- prefix=/usr/local/mfs\ # specify the installation path-- with-default-user=mfs\ # specify the running user, and the group is mfs--with-default-group=mfs\-- disable-mfsmaster\ # turn off the master function-- disable-mfsmount # turn off mounting make & & make install replication configuration file cd / usr/local/mfs/etc/mfs/cp mfschunkserver.cfg.dist mfschunkserver.cfgcp mfshdd.cfg.dist mfshdd.cfg

Modify the configuration file vi mfschunkserver.cfgMASTER_HOST = 192.168.30.55

Specify the MFS shared file storage directory. The actual production environment needs to provide a separate disk array as a special MFS storage directory. This is just an experiment, so use a separate directory instead of vi mfshdd.cfg/data.

Mkdir / datachown-R mfs:mfs / data Startup Service / usr/local/mfs/sbin/mfschunkserver startps aux | grep mfs

4. Client client configuration yum installation compilation environment package yum install-y zlib-devel gcc gcc-c++ create run user mfsuseradd mfs-s / sbin/nologin install the fuse plug-in before installing the MFS source code package The MFS client relies on fusetar xzvf fuse-2.9.2.tar.gzcd fuse-2.9.2./configuremake & & make install to set the environment variable echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" > > / etc/profilesource / etc/profile to install the mfs source package client tar zxvf mfs-1.6.27-5.tar.gz # decompress the source package cd mfs-1.6. 27/./configure\-- prefix=/usr/local/mfs\ # specify the installation path-- with-default-user=mfs\ # specify the running user Group mfs--with-default-group=mfs\-- disable-mfsmaster\ # disable master function-- disable-mfschunkserver\ # disable node function-- enable-mfsmount # disable mount make & & make install mount MFS file system mkdir / opt/mfs / / create mount point modprobe fuse / / mount the fuse module to the kernel / usr/local/mfs/bin/mfsmount / opt/mfs-H 192.168.30.55 mount MFSdf-hT to view the mount

If you want to uninstall, use umount / opt/mfs. Optimize client echo "export PATH=/usr/local/mfs/bin:$PATH" > > / etc/profilesource / etc/profileMFS Common Operation MFS will generate / usr/local/mfs/bin directory after client installation. There are many commands in this directory. Mfsgetgoal: used to query the number of copies of files. Use the-r option to recurse the entire directory. Goal refers to the number of files copied mfssetgoal: sets the number of files to be restored. The number of chunk server nodes in a production environment should be at least greater than 2, and the number of file copies should be less than or equal to the number of chunk server servers mfsgetgoal-r / opt/mfsmfssetgoal-r 2 / opt/mfs/echo abc123 > / opt/mfs/test1

You can view the stored file units on the chunk server

All the configuration work has been done. Starting monitoring Mfscgiserv on Master Server is a web server written in python. Its listening port is 9425, which can be started by command / usr/local/mfs/sbin/mfscgiserv on master server. Users can use the browser to fully monitor all customer mounts, chunk server,master server. And various operations of the client / usr/local/mfs/sbin/mfscgiserv to access http://192.168.30.55:9425 through the browser

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report