服务器存储之Raid技术详解

举报
江湖有缘 发表于 2023/01/16 13:41:02 2023/01/16
【摘要】 服务器存储之Raid技术详解

一、RAID介绍

1.RAID理解

RAID:独立磁盘冗余阵列(Redundant Array of Independent Drives),磁盘阵列是由很多块独立的磁盘,组合成一个容量巨大的磁盘组,利用个别磁盘提供数据所产生加成效果提升整个磁盘系统效能。利用这项技术,将数据切割成许多区段,分别存放在各个硬盘上。

2.RAID优点

RAID技术主要有以下三个基本功能:
(1)通过对磁盘上的数据进行条带化,实现对数据成块存取,减少磁盘的机械寻道时间,提高了数据存取速度。
(2)通过对一个阵列中的几块磁盘同时读取,减少了磁盘的机械寻道时间,提高数据存取速度。
(3)通过镜像或者存储奇偶校验信息的方式,实现了对数据的冗余保护。

3.RAID分类

①软件 RAID
软件 RAID 的性能较低,因为其使用主机的资源。 需要加载 RAID 软件以从软件 RAID 卷中读取数据。在加载 RAID 软件前,操作系统需要引导起来才能加载 RAID 软件。在软件 RAID 中无需物理硬件。零成本投资。
②硬件 RAID
硬件 RAID 的性能较高,他们采用 PCI Express 卡物理地提供有专用的 RAID 控制器。它不会使用主机资源。他们有 NVRAM 用于缓存的读取和写入。缓存用于 RAID 重建时,即使出现电源故障,它会使用后备的电池电源保持缓存。对于大规模使用是非常昂贵的投资。

二、RAID0

1.RAID0介绍

基于striping方式(data striping是一种切割逻辑上连续数据的技术,例如切割文件,使得连续的片段可以被存储在不同的物理存储设备上。)来组织数据,不具备镜像(mirror,即数据冗余)和校验的功能。

2.RAID0图示

在这里插入图片描述

3.RAID0特点

①高性能。
②RAID 0 中容量零损失。
③零容错。
④写和读有很高的性能。

三、RAID1

1.RAID1介绍

基于镜像(mirroring)的方式,当写入数据的时候,会同时写入每个磁盘设备。

2.RAID1图解

在这里插入图片描述

3.RAID1特点

①良好的性能。
②总容量丢失一半可用空间。
③完全容错。
④重建会更快。
⑤写性能变慢。
⑥读性能变好。
⑦能用于操作系统和小规模的数据库。

四、RAID5

1.RAID5介绍

RAID5(分布式奇偶校验的独立磁盘结构),RAID 5 多用于企业级, RAID 5 的以分布式奇偶校验的方式工作。奇偶校验信息将被用于重建数据。它从剩下的正常驱动器上的信息来重建。在驱动器发生故障时,这可以保护我们的数据。

2.RAID5图示

在这里插入图片描述

3.RAID5特点

优点:
①性能卓越
②读速度将非常好。
③写速度处于平均水准,如果我们不使用硬件 RAID 控制器,写速度缓慢。
④从所有驱动器的奇偶校验信息中重建。
⑤完全容错。
⑥1个磁盘空间将用于奇偶校验。
⑦可以被用在文件服务器,Web服务器,非常重要的备份中。
缺点:

①无镜像能力,虽然存在数据恢复能力,但是数据盘损坏后,基于校验码恢复数据会有额外的计算开销。
②单校验问题,此前的所有具备校验能力的RAID亦均有此问题。

五、RAID6

1.RAID6介绍

类似于RAID 5,RAID 6基于块(block)级别切割数据至多个磁盘,具备分布式校验码。只不过是使用了双校验码(double-parity)机制。双校验支持损坏至多2块磁盘。这使得更大的RAID阵列更加实用,尤其对于高可用系统,因为大容量的阵列需要更长的时间重建。至少需要4块磁盘。和RAID 5一样,单块磁盘故障会降低整体阵列性能,直到故障盘被替换。如果磁盘的容量和阵列的容量越大的话,那么越应该考虑使用RAID 6来替代RAID 5。RAID 10同样也最小化了这些问题。

2.RAID6图示

在这里插入图片描述

3.RAIDD6特点

①性能不佳。
②读的性能很好。
③如果我们不使用硬件 RAID 控制器写的性能会很差。
④从两个奇偶校验驱动器上重建。
⑤完全容错。
⑥2个磁盘空间将用于奇偶校验。
⑦可用于大型阵列。
⑧用于备份和视频流中,用于大规模。

六、RAID10

1.RAID10介绍

也叫作RAID 0+1或者RAID 0&1,先将磁盘制作成RAID 0,再将每个RAID 0组合成RAID 1。

2.RAID10图示

在这里插入图片描述
在这里插入图片描述

3.RAID10特点

①良好的读写性能。
②总容量丢失一半的可用空间。
③容错。
④从副本数据中快速重建。
⑤由于其高性能和高可用性,常被用于数据库的存储中。

七、LINUX下的RAID命令

1.检查安装mdadm工具

[root@control ~]# mdadm --help
mdadm is used for building, managing, and monitoring
Linux md devices (aka RAID arrays)
Usage: mdadm --create device options...
            Create a new array from unused devices.
       mdadm --assemble device options...
            Assemble a previously created array.
       mdadm --build device options...
            Create or assemble an array without metadata.
       mdadm --manage device options...
            make changes to an existing array.
       mdadm --misc options... devices
            report on or modify various md related devices.
       mdadm --grow options device
            resize/reshape an active array
       mdadm --incremental device
            add/remove a device to/from an array as appropriate
       mdadm --monitor options...
            Monitor one or more array for significant changes.
       mdadm device options...
            Shorthand for --manage.
Any parameter that does not start with '-' is treated as a device name
or, for --examine-bitmap, a file name.
The first such name is often the name of an md device.  Subsequent
names are often names of component devices.

 For detailed help on the above major modes use --help after the mode
 e.g.
         mdadm --assemble --help
 For general help on options use
         mdadm --help-options

2.检查系统RAID安装情况

[root@control ~]#  fdisk -l | grep -i "raid"
[root@control ~]# cat /proc/partitions 
major minor  #blocks  name

 259        0   20971520 nvme0n1
 259        1     512000 nvme0n1p1
 259        2    5242880 nvme0n1p2
 259        3    2097152 nvme0n1p3
 259        4          1 nvme0n1p4
 259        5   13117440 nvme0n1p5
  11        0    6936576 sr0
   8        0   20971520 sda
   8       16   20971520 sdb
[root@control ~]# lsblk 
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0   20G  0 disk 
sdb           8:16   0   20G  0 disk 
sr0          11:0    1  6.6G  0 rom  /mnt/cdrom
nvme0n1     259:0    0   20G  0 disk 
├─nvme0n1p1 259:1    0  500M  0 part /boot
├─nvme0n1p2 259:2    0    5G  0 part /home
├─nvme0n1p3 259:3    0    2G  0 part [SWAP]
├─nvme0n1p4 259:4    0    1K  0 part 
└─nvme0n1p5 259:5    0 12.5G  0 part /

3.Mdadm工具使用语法

[root@control ~]# mdadm --manage --help
Usage: mdadm arraydevice options component devices...

This usage is for managing the component devices within an array.
The --manage option is not needed and is assumed if the first argument
is a device name or a management option.
The first device listed will be taken to be an md array device, any
subsequent devices are (potential) components of that array.

Options that are valid with management mode are:
  --add         -a   : hotadd subsequent devices to the array
  --re-add           : subsequent devices are re-added if there were
                     : recent members of the array
  --remove      -r   : remove subsequent devices, which must not be active
  --fail        -f   : mark subsequent devices a faulty
  --set-faulty       : same as --fail
  --replace          : mark device(s) to be replaced by spares.  Once
                     : replacement completes, device will be marked faulty
  --with             : Indicate which spare a previous '--replace' should
                     : prefer to use
  --run         -R   : start a partially built array
  --stop        -S   : deactivate array, releasing all resources
  --readonly    -o   : mark array as readonly
  --readwrite   -w   : mark array as readwrite
[root@control ~]# 

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。