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

Detailed explanation of MFS distributed Storage Construction

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

Share

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

MFS distributed storage service

The role of MFS:

The purpose of MFS distributed storage is to solve the deficiency of NFS. Multiple servers mount and share through NFS.

The storage space of a server makes the NFS server unbearable, often occurs the phenomenon of timeout, and NFS has a single point of failure

Although you can use rsync to synchronize data to another server for backup, it does not help to improve system performance. So the solution

With MFS distributed file system, the data access between servers is no longer an one-to-many relationship, but a many-to-many relationship.

What is distributed storage:

Distributed principle: connect to nodes through a computer network, which is simply to aggregate some scattered shared folders into a virtual text.

Inside the clip. For the user, accessing these shared folders only opens a virtual folder, and the user does not feel that these shared folders are divided into

It's on every computer. The advantages of distributed file system are centralized access, simplified operation, data disaster tolerance, and improve file access performance.

MFS principle:

1) the composition of MFS file system.

● metadata server (master): responsible for managing the file system and maintaining metadata throughout the system.

● metadata Log Server (metaLogger): when MAster server data is lost or corrupted, files can be obtained from the log server and recovered.

● data Storage Server (chunkserver): the server that actually stores data. When saving a file, the file is saved in blocks.

● client: you can mount the MFS file system in the same way as you do.

2) the process of reading data by MFS.

The ● client makes a request to the metadata server.

The ● metadata server informs the client where the required data is stored.

The ● client sends data to a known Chunk server request.

● Chunk Server sends data to the client.

3) the process of writing data from MFS

The ● client sends a write request to the metadata server

The ● metadata server interacts with Chunk Server and creates a new chunked Chunks on Chunk Server and informs the meta-server.

The ● metadata server tells the client that the data can be written on which chunked Chunks of which Chunk Server.

The ● client specifies that Chunk Server writes data.

● the Chunk Server is synchronized with other Chunk Server, and the synchronization successfully informs the client that the write is successful.

The ● client tells the metadata server that the write is complete this time.

The lab topology is as follows:

In this experiment, 5 servers are used to simulate the construction of MFS file system.

Experimental environment:

Role type operating system ip address main software Master ServerCentos7192.168.60.141moosefs-3.0.100-1.tar.gzMetaLogger ServerCentos7192.168.60.136moosefs-3.0.100-1.tar.gzChunk Server1Centos7192.168.60.143moosefs-3.0.100-1.tar.gzChunk Server2Centos7192.168.60.144moosefs-3.0.100-1.tar.gzClientCentos7192.168.60.130fuse-2.9.2.tar.gz, moosefs-3.0.100-1.tar.gz

First, set up Master Server server

1. Decompress and install the environment package

Tar zxf moosefs-3.0.100-1.tar.gz-C / opt

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

2. Create users, compile

Cd / opt/moosefs-3.0.100/

Useradd-s / sbin/nologin mfs # create mfs administrative user

. / configure-- prefix=/usr/local/mfs\ # compilation

-- with-default-user=mfs\ # specify administrative user

-- with-default-group=mfs\ # specify the management group

-- disable-mfschunkserver\ # disable nodes

-- disable-mfsmount # disable client mount

Make & & make install

3. Copy the configuration file

Cd / usr/local/mfs/etc/mfs

Cp mfsexports.cfg.dist mfsexports.cfg

Cp mfsmaster.cfg.dist mfsmaster.cfg

Cp mfstopology.cfg.dist mfstopology.cfg

Cd / usr/local/mfs/var/mfs/

Cp metadata.mfs.empty metadata.mfs

4. Optimize and start the service detection port

Ln-s / usr/local/mfs/sbin/* / usr/local/sbin # put mfs commands into the system to identify

Mfsmaster start # launch mfsmaster

[root@localhost mfs] # netstat-ntap | grep mfs # see three listening ports

Tcp 0 0 0.0.0 0 9419 0.0.0 0 V * LISTEN 42551/mfsmaster

Tcp 0 0 0.0.0.0 9420 0.0.0. 0 LISTEN 42551/mfsmaster

Tcp 0 0 0.0.0.0 9421 0.0.0. 0 LISTEN 42551/mfsmaster

Second, set up MetaLogger Server server

1. Extract and install the environment package

Tar zxf moosefs-3.0.100-1.tar.gz-C / opt

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

2. Create users, compile

Cd / opt/moosefs-3.0.100/

Useradd-s / sbin/nologin mfs

. / configure-- prefix=/usr/local/mfs\

-- with-default-user=mfs\

-- with-default-group=mfs\

-- disable-mfschunkserver\ # disable nodes

-- disable-mfsmount # disable client mount

Make & & make install

3. Copy the configuration file and modify

Cd / usr/local/mfs/etc/mfs/

Cp mfsexports.cfg.dist mfsexports.cfg

Cp mfsmaster.cfg.dist mfsmaster.cfg

Cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

Vim mfsmetalogger.cfg

MATER_HOST = 192.168.60.141 # find the MATER_HOST template with the ip address pointing to master

Cd / usr/local/mfs/var/mfs/

Cp metadata.mfs.empty metadata.mfs

4. Optimize and start the service detection port

Ln-s / usr/local/mfs/sbin/* / usr/local/sbin/ # put mfs commands into the system to identify

Mfsmetalogger start # start the service

[root@localhost mfs] # netstat-ntap | grep mfs # check whether the status is up or not

Tcp 0 1 192.168.60.136:55894 220.250.64.225:9419 SYN_SENT 42707/mfsmetalogger

Third, set up Chunk node server

1. Decompress and install the environment package

Tar zxf moosefs-3.0.100-1.tar.gz-C / opt

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

2. Create users and compile

Cd / opt/moosefs-3.0.100/

Useradd-s / sbin/nologin mfs

. / configure-- prefix=/usr/local/mfs\

-- with-default-user=mfs\

-- with-default-group=mfs\

-- disable-mfsmaster\ # disable master mode

-- disable-mfsmount # disable user mount

Make & & make install

3. Copy the configuration file and modify

Cd / usr/local/mfs/etc/mfs

Cp mfschunkserver.cfg.dist mfschunkserver.cfg

Cp mfshdd.cfg.dist mfshdd.cfg

Vim mfschunkserver.cfg

MASTER_HOST = 192.168.60.141 # find the MASTER_HOST template with the IP address pointing to master

Vim mfshdd.cfg

# etc.

/ data # to set a shared directory data, you need to create

4. Create a shared directory and change the array owner

Mkdir / data

Chown-R mfs.mfs / data/

5. Optimize and start the service view port

Ln-s / usr/local/mfs/sbin/* / usr/local/sbin/ # put mfs commands into the system to identify

Mfschunkserver start # start the service

[root@localhost mfs] # netstat-ntap | grep mfs # check whether the status is up or not

Tcp 0 0 0.0.0 0 9422 0.0.0 0 V * LISTEN 42714/mfschunkserve

Tcp 0 0 192.168.60.144:41774 192.168.60.141:9420 ESTABLISHED 42714/mfschunkserve

The configuration of the two node servers is the same, so you can repeat the operation.

Fourth, set up the client

1. Decompress and install the environment package

Tar zxf moosefs-3.0.100-1.tar.gz-C / opt

Tar zxf fuse-2.9.2.tar.gz-C / opt/

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

2. Install and configure fuse

Cd / opt/fuse-2.9.2/

. / configuer # compiling fuse

Make & make install

Sed-I'$an export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH' / etc/profile

Source / etc/profile

Cd / opt/moosefs-3.0.100/ # compiling mfs

Useradd mfs-s / sbin/nologin

. / configure-- prefix=/usr/local/mfs\

-- with-default-user=mfs\

-- with-default-group=mfs\

-- disable-mfsmater\ # disable master

-- disable-mfschunkserver\ # disable nodes

-- enable-mfsmount # enable user mount

Make & & make install

3. Mounting

Mkdir / opt/mfs # create a mount directory

/ usr/local/mfs/bin/mfsmount / opt/mfs-H 192.168.60.141 # Mount

Df-h # View mount status

192.168.60.141purl 9421 33G 0 33G 0 / opt/mfs

4. Some simple operations on the client

Sed-I'$an export PATH=/usr/local/mfs/bin:$PATH' / etc/profile # mfs optimization

Source / etc/profile # refresh environment variables

Cd / opt/mfs

Echo "this is test" > test.txt

The mfsgetgoal-r / opt/mfs # mfsgetgoal command is used to query the number of copied files

The mfssetgoal-r 3 / opt/mfs # mfssetgoal command is used to set the number of copies of a file

5. MFS monitoring

Turn on monitoring on the primary 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.60.141:9425 # use the port it gives you to access

6. Yum installs MFS extension

MFS can also be installed with yum, and the yum source needs to be configured

Introduction of each system on https://moosefs.com/download/ official website. Here I will introduce the installation of centos.

Curl "https://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > / etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS"

Curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > / etc/yum.repos.d/MooseFS.repo"

The above two sentences are to configure the yum warehouse

Master server yum installation operation:

Yum install moosefs-master moosefs-cgi moosefs-cgiserv moosefs-cli

Operation of the chunkserver server yum installation:

Yum install moosefs-chunkserver

Operation of the MetaLogger Server server yum installation:

Yum install moosefs-metalogger

Operation of yum installation on client:

Yum install moosefs-client

The operation of modifying the configuration file is the same as that of manual compilation

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