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

Network storage cluster

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

Share

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

Classification of network storage:

Classified by network topology:

1. DAS: directly attach storage; advantages: simple technology, high transmission rate; disadvantages: storage devices and disks bind each other.

2. NAS: network attached storage; advantages: the technology is relatively simple, storage devices are not required to be directly connected to the local computer, only network access is needed; disadvantages: the storage rate is slow.

3. SAN: storage area network; advantages: high storage security and high storage rate; disadvantages: high cost and relatively high technical difficulty.

Classified by storage technology:

1, block storage (hard disk, U disk, etc.); advantages: can be protected by raid/lvm and other technologies, can be used independently; disadvantages: not conducive to sharing.

2. File storage / network storage (samba, nfs, ftp); advantages: low construction funds, storage can be shared before different hosts; disadvantages: low read and write rate, slow transfer rate.

3. Object storage / distributed storage / bucket (focus on storing metadata and real data on multiple servers respectively); advantages: high reading and writing efficiency and sharing storage among different hosts; disadvantages: high cost and high difficulty in technical implementation.

Common modes:

1. Block storage + DAS: underlying technology

2. Block storage + NAS

3. Block storage + SAN

4. File Storage + NAS:NFS, Samba, ftp

5. Object Storage + SAN:MFS, RHCS, ceph, etc.

NFS of file storage: relying on RPC protocol for transmission

Nfs-utils:NFS service main package

RPC main package for rpcbind:centos6 and 7 (centos5 is portmap)

Server-side NFS configuration:

/ etc/exports:nfs configuration file; format:

NFS shared directory NFS client address 1 (parameter 1, parameter 2.) NFS client address 2 (parameter 1, parameter 2.) # can represent multiple shares on multiple lines

Common parameters:

Rw: can read and write. Directory permissions are required to participate together

Ro: read-only

Sync: files are written to both hard disk and memory

Async: files are temporarily stored in memory instead of being written directly to memory

No_root_squash: allow root permissions

Root_squash: map the rights of root users to anonymous user rights (nobody or nfsnobody)

All_squash: all users are mapped to anonymous user rights (nobody or nfsnobody)

Anonuid: uid of anonymous users

Anongid: gid of anonymous users

Example:

Server end

~] # yum-y install rpcbind nfs-utils

~] # mkdir-pv / nfs1 / nfs2

~] # chown-R nobody:nobody / nfs1 / nfs2

~] # vim / etc/exports

/ nfs1 192.168.0.0 rw,no_root_squash,async 24 (rw,no_root_squash,async) 172.20.120.0 Universe 24 (rw,no_root_squash,async)

/ nfs2 172.20.120.0 Compact 24 (ro,no_root_squash,async)

~] # systemctl restart rpcbind

~] # systemctl restart nfs

Clinet end

~] # yum-y install nfs-utils

~] # showmount-e 172.20.120.182

~] # mkdir-pv / tmp/nfs [1pm 2]

~] # mount-t nfs 172.20.120.182:/nfs1 / tmp/nfs1

~] # mount-t nfs 172.20.120.182:/nfs2 / tmp/nfs2

MFS (MooseFS) for distributed storage: a distributed network file system with redundant fault tolerance.

Properties:

Disadvantages:

MFS component description:

1. Master (managin server): distribute user requests and store metadata

2. Metalogger (metadata backup servers): back up the metadata information log files of master changes

3. Data (chunk server): stores data file entities

4. Client (client server): the client that mounts and uses the mfs file system; requires the system to support fuse

Master main configuration file: mfsmaster.cfg

Example: 1 master,1, metalogger,2, data,1, client

The example here is moosefs-3.0.84; download address: https://github.com/moosefs/moosefs/releases/tag/v3.0.84

Master settings:

~] # tar xvf moosefs-3.0.84.tar.gz-C / usr/local/

~] # cd / usr/local/moosefs-3.0.84/

Moosefs-3.0.84] # useradd-s / sbin/nologin-M mfs

Moosefs-3.0.84] # yum-y groupinstall "Development Tools"

Moosefs-3.0.84] # yum-y install zlib-devel

Moosefs-3.0.84] #. / configure-- prefix=/usr/local/mfs-- with-default-user=mfs-- with-default-group=mfs

Moosefs-3.0.84] # make & & make install

Moosefs-3.0.84] # chown-R mfs:mfs / usr/local/mfs/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/bin/mfscli / usr/local/bin/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/sbin/* / usr/local/sbin/

~] # cp-a / usr/local/mfs/etc/mfs/mfsmaster.cfg.sample / usr/local/mfs/etc/mfs/mfsmaster.cfg

~] # cp-a / usr/local/mfs/etc/mfs/mfsexports.cfg.sample / usr/local/mfs/etc/mfs/mfsexports.cfg

~] # vim / usr/local/mfs/etc/mfs/mfsexports.cfg

172.20.120.0/24. Rw,alldirs,maproot=0 # set MFS mount permissions

~] # cp / usr/local/mfs/var/mfs/metadata.mfs.empty / usr/local/mfs/var/mfs/metadata.mfs # initialize MFS metadata information file

Optional service (mfscgiserv): open the web monitoring page on port 9425; you can call zabbix

Set self-boot:

~] # systemctl start moosefs-master moosefs-cgiserv # start MFS-master service and mfscgiserv service

~] # systemctl enable moosefs-master moosefs-cgiserv

Appendix: centos7 system script production: moosefs-master.service

~] # vim / usr/lib/systemd/system/moosefs-master.service

[Unit]

Description=MooseFS Master server

Wants=network-online.target

After=network.target network-online.target

[Service]

Type=forking

ExecStart=/usr/local/mfs/sbin/mfsmaster-a

ExecStop=/usr/local/mfs/sbin/mfsmaster stop

ExecReload=/usr/local/mfs/sbin/mfsmaster reload

PIDFile=/usr/local/mfs/var/mfs/.mfsmaster.lock

TimeoutStopSec=1800

TimeoutStartSec=1800

Restart=no

[Install]

WantedBy=multi-user.target

Appendix: centos7 system script production: moosefs-cgiserv.service

~] # vim / usr/lib/systemd/system/moosefs-cgiserv.service

[Unit]

Description=MooseFS CGI server

Wants=network-online.target

After=network.target network-online.target

[Service]

Type=forking

ExecStart=/usr/local/mfs/sbin/mfscgiserv start

ExecStop=/usr/local/mfs/sbin/mfscgiserv stop

PIDFile=/usr/local/mfs/var/mfs/.mfscgiserv.lock

Restart=on-abnormal

[Install]

WantedBy=multi-user.target

Metalogger settings:

~] # tar xvf moosefs-3.0.84.tar.gz-C / usr/local/

~] # cd / usr/local/moosefs-3.0.84/

Moosefs-3.0.84] # useradd-s / sbin/nologin-M mfs

Moosefs-3.0.84] # yum-y groupinstall "Development Tools"

Moosefs-3.0.84] # yum-y install zlib-devel

Moosefs-3.0.84] #. / configure-- prefix=/usr/local/mfs-- with-default-user=mfs-- with-default-group=mfs

Moosefs-3.0.84] # make & & make install

Moosefs-3.0.84] # chown-R mfs:mfs / usr/local/mfs/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/bin/mfscli / usr/local/bin/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/sbin/* / usr/local/sbin/

Moosefs-3.0.84] # cp-a / usr/local/mfs/etc/mfs/mfsmetalogger.cfg.sample / usr/local/mfs/etc/mfs/mfsmetalogger.cfg

Moosefs-3.0.84] # vim / usr/local/mfs/etc/mfs/mfsmetalogger.cfg

META_DOWNLOAD_FREQ = 2 # set the full synchronization interval to 2 hours

MASTER_HOST = 172.20.120.187 # set master server ip address

Moosefs-3.0.84] # systemctl start moosefs-metalogger # start the service and boot automatically

Moosefs-3.0.84] # systemctl enable moosefs-metalogger

Moosefs-3.0.84] # lsof-I: 9419 # verify whether to contact master

Moosefs-3.0.84] # ls / usr/local/mfs/var/mfs/ # check whether the metadata information has been synchronized

Appendix: centos7 system script production: moosefs-metalogger.service

~] # vim / usr/lib/systemd/system/moosefs-metalogger.service

[Unit]

Description=MooseFS Metalogger server

Wants=network-online.target

After=network.target network-online.target

[Service]

Type=forking

ExecStart=/usr/local/mfs/sbin/mfsmetalogger start

ExecStop=/usr/local/mfs/sbin/mfsmetalogger stop

ExecReload=/usr/local/mfs/sbin/mfsmetalogger reload

PIDFile=/usr/local/mfs/var/mfs/.mfsmetalogger.lock

Restart=on-abnormal

[Install]

WantedBy=multi-user.target

Chunk server settings:

Prepare the shared device, which is a stand-alone hard drive

~] # mkfs.xfs / dev/vdb1

~] # mkdir-pv / mfs

~] # mount / dev/vdb1 / mfs

~] # chown-R mfs:mfs / mfs

~] # vim / etc/fstab # set boot mount

/ dev/vdb1 / mfs xfs defaults 0 0

Installation configuration

~] # tar xvf moosefs-3.0.84.tar.gz-C / usr/local/

~] # cd / usr/local/moosefs-3.0.84/

Moosefs-3.0.84] # useradd-s / sbin/nologin-M mfs

Moosefs-3.0.84] # yum-y groupinstall "Development Tools"

Moosefs-3.0.84] # yum-y install zlib-devel

Moosefs-3.0.84] #. / configure-- prefix=/usr/local/mfs-- with-default-user=mfs-- with-default-group=mfs

Moosefs-3.0.84] # make & & make install

Moosefs-3.0.84] # chown-R mfs:mfs / usr/local/mfs/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/bin/mfscli / usr/local/bin/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/sbin/* / usr/local/sbin/

Moosefs-3.0.84] # cp-a / usr/local/mfs/etc/mfs/mfschunkserver.cfg.sample / usr/local/mfs/etc/mfs/mfschunkserver.cfg

Moosefs-3.0.84] # vim / usr/local/mfs/etc/mfs/mfschunkserver.cfg

MASTER_HOST = 172.20.120.187 # specify master server ip

HDD_CONF_FILENAME = / usr/local/mfs/etc/mfs/mfshdd.cfg

Moosefs-3.0.84] # cp-a / usr/local/mfs/etc/mfs/mfshdd.cfg.sample / usr/local/mfs/etc/mfs/mfshdd.cfg

Moosefs-3.0.84] # vim / usr/local/mfs/etc/mfs/mfshdd.cfg

/ mfs # specify a shared device

~] # systemctl start moosefs-chunkserver # start the service and boot automatically

~] # systemctl enable moosefs-chunkserver

Appendix: centos7 system script production: moosefs-chunkserver.service

~] # vim / usr/lib/systemd/system/moosefs-chunkserver.service

[Unit]

Description=MooseFS Chunkserver

Wants=network-online.target

After=network.target network-online.target

[Service]

Type=forking

ExecStart=/usr/local/mfs/sbin/mfschunkserver start

ExecStop=/usr/local/mfs/sbin/mfschunkserver stop

ExecReload=/usr/local/mfs/sbin/mfschunkserver reload

PIDFile=/usr/local/mfs/var/mfs/.mfschunkserver.lock

Restart=on-abnormal

[Install]

WantedBy=multi-user.target

Clinet side Settin

~] # yum-y install fuse fuse-libs fuse-devel # install fuse

~] # tar xvf moosefs-3.0.84.tar.gz-C / usr/local/

~] # cd / usr/local/moosefs-3.0.84/

Moosefs-3.0.84] # useradd-s / sbin/nologin-M mfs

Moosefs-3.0.84] # yum-y groupinstall "Development Tools"

Moosefs-3.0.84] #. / configure-- prefix=/usr/local/mfs-- with-default-user=mfs-- with-default-group=mfs-- disable-mfsmaster-- disable-mfschunkserver

Moosefs-3.0.84] # make & & make install

Moosefs-3.0.84] # chown-R mfs:mfs / usr/local/mfs/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/bin/* / usr/local/bin/

Moosefs-3.0.84] # ln-sv / usr/local/mfs/sbin/* / usr/local/sbin/

Create and mount

~] # mkdir-pv / mfs

~] # mfsmount / mfs/-H 172.20.120.187

~] # chown-R mfs:mfs / mfs

~] # vim / mfs/1.txt

~] # mfsfileinfo / mfs/1.txt # View file information

Power on and mount automatically

~] # vim / etc/rc.d/rc.local

/ usr/local/bin/mfsmount / mfs-H 172.20.120.187

~] # chmod adepx / etc/rc.d/rc.local

MFS maintenance operations:

1. Recover deleted files within trashtime time: (default is 1 day after erroneous deletion)

~] # mkdir-pv / mfsback

~] # chown-R mfs:mfs / mfsback

~] # mfsmount-m / mfsback/-H 172.20.120.187

~] # find / mfsback/-name "* 2.txt" # if you know the name of the file deleted by mistake, locate the file here

~] # mv / mfsback/trash/009/00000009\ | 2.txt / mfsback/trash/undel/

2. Snapshot function:

~] # mkdir-pv / mfs/mfssnap # is required on the same device as the source file

~] # chown-R mfs:mfs / mfs/mfssnap/

~] # mfsmakesnapshot / mfs/2.txt / mfs/mfssnap/

3. Redundant goal settings (default is 2)

~] # mfssetgoal 1 / mfs/1.txt # set the number of 1.txt copies to 1

~] # mfsgetgoal / mfs/1.txt # View Verification

~] # mfsfileinfo / mfs/1.txt

4. Restore master

Refactoring the master environment (omitted)

The metalogger side transmits the data to master:

~] # scp / usr/local/mfs/var/mfs/* root@172.20.120.187:/usr/local/mfs/var/mfs/

Master recovery and startup: (it takes a certain amount of time to recover data)

~] # mfsmaster-a

5. Highly available master server

ISCSI of block storage:

The difference from the file system: 1, provide block storage; 2, transfer iscsi instructions, more efficient

ISCSI technology is divided into server (target) and client (initiator) in the form of work.

1. The iSCSI server is the server used to store hard disk storage resources. As the storage side of the RAID disk array created earlier, it can provide users with available storage resources.

2. The iSCSI client is the software used by users to access the storage resources of the remote server.

Server settings:

1. Prepare block devices for sharing (you can make disks, partitions, logical volumes); the example here is / dev/vdc1 partition

2. Install and configure the target end

~] # yum-y install scsi-target-utils

~] # vim / etc/tgt/conf.d/test.conf persists configuration through configuration file

# configure shared disk

Vendor_id hbzh # configure publisher (any)

Lun 1 # configure LUN number

Incominguser iscsiuser iscsiuser # configure username and password for authentication

Initiator-address 172.20.120.0Comp24 # configure allowed IP address ranges

~] # systemctl start tgtd

~] # systemctl enable tgtd

~] # tgtadm-L iscsi-o show-m target # verify configuration

Client settings:

~] # yum-y install iscsi-initiator-utils

~] # vim / etc/iscsi/iscsid.conf

Node.session.auth.username = iscsiuser # enter the user password set on the server side

Node.session.auth.password = iscsiuser

~] # iscsiadm-m discovery-t st-p 172.20.120.184 # perform discovery operation

~] # iscsiadm-m node-T iqn.2020-01.com.nice.www:iscsi.sda-- login # login operation

~] # fdisk-l # View the newly added hard disk information

Follow-up operation by physical hard disk operation (formatting, mounting, using)

Power on and mount automatically

~] # vim / etc/fstab

/ dev/sda1 / tmp/iscsi xfs _ netdev 0 0

~] # systemctl start iscsi

~] # systemctl enable iscsi

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