Configure MFS distributed architecture cluster in Linux
With the continuous development of distributed and big data, we often feel that big data is far away from us. What is big data in our minds? distributed, fault-tolerant, and large capacity?
In our O & M, the most common file storage system is probably NFS. However, as the website pressure increases, NFS gradually cannot meet the needs of enterprise data growth, what about automatic scaling, efficient deployment, and fast implementation of distributed storage? Let's take a look at how MFS can basically meet our needs.
MogileFS is a distributed file storage system. Supports automatic file backup to improve availability and scalability. MogileFS does not support random or sequential reads and writes to a file. Therefore, it is only suitable for some applications, slice services, static HTML services, and file servers, these applications do not need to modify the file after writing the file, but they can generate a new file to overwrite the original file.
The Distributed File System (Distributed File System) means that the physical 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, the Distributed File System is actually based on the Client/Server mode.
There are many common distributed file systems, such as Hadoop, FastDFS, Moosefs, and PNFS (Parallel NFS) mentioned in my previous article), Lustre, TFS, GFS, HDFS, and so on. Among the many distributed file system solutions, MFS is easy to build and does not require too many modifications to web programs. Today, we use the SHELL script to deploy MFS.
I. Advantages of Moosefs:
1) General-purpose file systems can be used without modifying upper-layer applications.
2) Online resizing and strong system architecture Scalability (the official case can be expanded to 70 ).
3) easy deployment.
4) The system architecture is highly available. If a single machine fails, the overall performance will not be affected.
5) file objects are highly available. You can set any file redundancy level (providing a higher redundancy level than raid1 + 0) without affecting reading or writing performance.
6) provides the Windows recycle bin function (without fear of misoperations, and provides instant rollback features similar to oralce's flash back and other advanced dbms, which are charged)
7) provides snapshot features for commercial storage such as netapp, emc, and ibm.
8) A c Implementation of google filesystem.
9) provides a web gui monitoring interface.
10) Improve the random read or write efficiency.
11) Improve the reading and writing efficiency of massive small files.
Ii. MFS system components:
1. metadata server: manages the file system throughout the system. Currently, MFS only supports one metadata server master, which is a single point of failure and requires a stable server. We hope that MFS will support multiple master servers in the future to further improve system reliability.
2. Data Storage Server: chunkserver, the server that actually stores user data. When storing files, the files are first divided into blocks, and then these blocks are copied between chunkservers of the data server, there can be multiple data servers, and the larger the number, the smaller the "disk space" that can be used, the higher the reliability.
3. Client: The MFS client that stores and accesses the host is called MFS. After successfully mounting the MFS file system, you can share the virtual storage like NFS.
4. Metadata log server: backs up the change log files of the master server. The file type is changelog_ml. *. mfs, so that you can take over when the master server has a problem.
Iii. Master server Master installation:
When we install the master server, during the configuration process (./configure), we can cancel the installation of the chunk server.
(-- Disable-mfschunkserver) and the MooseFS client (-- disable-mfsmount). Install
The specific steps for the master server master are as follows:
Add mfs Group
Groupaddmfs
New system user mfs
Useradd-g mfs
Unzip and install:
Tar-zxvf mfs-1.6.27.tar.gz; cd mfs-1.6.27
Compilation Configuration:
./Configure -- prefix =/usr -- sysconfdir =/etc \
-- Localstatedir =/var/lib -- with-default-user = mfs \
-- With-default-group = mfs -- disable-mfschunkserver -- disable-mfsmount & make & makeinstall
After the master is successfully installed, many mfs files will be generated under/etc/MFS:
Cd/etc. Copy the following file:
Cp mfsmaster. cfg. dist mfsmaster. cfg
Cp mfsexports. cfg. dist mfsexports. cfg
Main configuration file, mount file, and other functions.
Add the following statement to/etc/mfs/mfsexports. cfg:
192.168.33.0/24/rw, alldirs, maproot = 0
Preparations before startup:
Cd/var/lib/mfs/
Cp metadata. mfs. empty metadata. mfs
Echo "192.168.33.10 mfsmaster">/etc/hosts
Start mfsmaster:/usr/sbin/mfsmasterstart
Start the Monitoring Service:/usr/sbin/mfscgiserv
Browser access address: http: // 192.168.33.10: 9425/mfs. cgi, You can see MFS information.
Iv. Mfsmetalogger server deployment:
The installation method is the same as the master's compilation and installation parameters. The final configuration is as follows:
Go to/etc/mfs/and perform the following operations:
Cp mfsmetalogger. cfg. dist mfsmetalogger. cfg
Echo "192.168.33.10 mfsmaster">/etc/hosts
Start the mfsmetalogger service,/usr/sbin/mfsmetalogger start
5. Chunk servers server deployment:
MFSChunk compilation parameters:
./Configure -- prefix =/usr -- sysconfdir =/etc -- localstatedir =/var/lib -- with-default-
User = mfs -- with-default-group = mfs -- disable-mfsmaster & make & makeinstall
The configuration method is as follows:
Cp mfschunkserver. cfg. dist mfschunkserver. cfg
Cp mfshdd. cfg. dist mfshdd. cfg
Change the configuration file mfshdd. cfg and add the following:
/Data/
Preparations before startup:
Echo "192.168.33.10 mfsmaster">/etc/hosts
Chown-R mfs: mfs/data
/Usr/sbin/mfschunkserverstart
6. Install the MFS client:
Install compilation parameters:
./Configure -- prefix =/usr -- sysconfdir =/etc -- localstatedir =/var/lib -- with-default-
User = mfs -- with-default-group = mfs -- disable-mfsmaster -- disable-mfschunkserver & make install
Preparations before startup:
Mkdir/mnt/mfs
Echo "192.168.33.10 mfsmaster">/etc/hosts
Test mounting the client:
/Usr/bin/mfsmount/mnt/mfs-H 192.168.33.10
Then we can perform regular operations on the files. Other application servers can mount the MFS file system to store the files.
7. Required MFS commands:
Set the number of copies. Three copies are recommended.
/Usr/bin/mfssetgoal-r 3/mnt/mfs
View a file
/Usr/bin/mfsgetgoal/mnt/mfs
View directory information
/Usr/bin/mfsdirinfo-H/mnt/mfs
Write Performance test:
Dd if =/dev/zero of = 1.img bs = 1 M count = 50
Read performance test:
Dd if = 1.img bs = 1 M | dd of =/dev/null
This article permanently updates the link address: