In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about the application of RAID disk array. Many people may not know much about it. In order to let you know more, Xiaobian summarizes the following contents for you. I hope you can gain something according to this article.
RAID is generally translated as disk array, the full name is Redundant Arrays of Inexpensive Disk, the original idea is derived from a research group project at the University of California, Berkeley, they hope to build a cheap, high availability disk array through a large number of cheap hard disks. However, RAID has developed to this day, which has deviated from the original intention of cheap price. But RAID also brings other benefits, how to choose the RAID level reasonably, can build a disk with higher availability, better fault tolerance.
RAID is mainly divided into software RAID and hardware RAID, software RAID is mainly implemented through the operating system, which will increase the burden on the CPU, so it is rarely used in actual scenarios. Hardware RAID uses independent hardware devices and control chips, and its overall performance is better than software RAID. RAID has different specifications, but can generally be divided into two types: standard RAID and hybrid RAID. Although RAID has many different specifications today, many of them are transitional experimental products that are rarely used in real production environments.
1. Standard RAID
1.1 RAID 0
RAID 0, also known as striping, connects more than two hard disks in series to form a single large-capacity disk. When data is stored, it is scattered across these disks. RIID is the fastest of all classes because data can be read and written in parallel. But RAID has neither redundancy nor fault tolerance. If one physical disk is damaged, all data is lost. Therefore, RAID is only used in some scenarios where data security requirements are not high, but speed requirements are high, such as video, image and other workstations.
1.2 RAID 1
RAID 1 is called mirroring technology and requires more than two hard disks to mirror each other. That is, the data on the master disk is exactly the same as the data on the mirror disk. Therefore, in a multithreaded operating system the data read speed will be greatly improved. RAID 1 reliability is very high, as long as there is a normal hard disk can ensure data integrity. But RAID has the disadvantage of wasting a lot of storage space.
RAID2-RAID4 is an experimental product rarely used in production environments.
1.3 RAID 5
RAID 5 introduces the function of data verification, and the verified data is stored on each hard disk separately. RAID 5 is actually a compromise between speed and reliability, and it is used more in practical scenarios. Storage costs are cheaper than RAID. RAID 5 requires at least 3 disks to implement.
1.4 RAID 6
RAID6 adds a second independent information check block compared to RAID 5. The two independent parity systems use different algorithms, and the reliability of the data is very high. Even if two disks fail at the same time, the data usage will not be affected. RAID 6 requires at least four disks.
2. Mixed RAID
2.1 JBOD
Strictly speaking, JBOD (Just a Bunch Of Disks) does not belong to RAID level, JBOD does not have strict specifications, mainly used to realize the logical combination of independent hard disk space into a large hard disk. If the hard disk is destroyed, the data stored on it cannot be retrieved. If the first hard drive is damaged, all data will be lost, which is even more dangerous than RAID 0. However, JBOD also has its application scenarios, such as Hadoop encourages the use of JBOD, because Hadoop has its own set of disaster recovery solutions.
2.2 RAID 01
RAID 01 is a combination of RAID 0 and RAID 1. The main solution is to divide the data into two groups and then mirror the data. RAID 0 first, RAID 1 later.
2.3 RAID 10
RAID 10 is the exact opposite of RAID 01 in that data is mirrored first and then grouped.
2.4 RAID 50
The combination of RAID 5 and RAID 0, first RAID 5, then RAID 0, that is, the striping access to multiple RAID 5 groups. RAID 50 is based on RAID 5, which requires at least three hard disks, and RAID 50 consists of multiple RAID 5 groups, so RAID requires at least six hard disks. RAID 50 can maintain operation if one hard disk in any one or more RAID 5 groups at the bottom is damaged, but if two hard disks in any one group are damaged at the same time, the entire RAID 50 group will fail.
Soft RAID via Linux:
RAID implementation in Linux is mainly achieved through mdadm.
mdadm is a patterned command. The main patterns are:
creation mode
management mode
monitor mode
growth model
assembly mode
The basic format of mdadm is:
# mdadm [mode] [options]
Assembly Mode RAID options are:
-l: Specify RAID level;
-n: Specify the number of devices, i.e. the number of disks;
-a: automatically create equipment files for it;
-c, --chunk Specifies the size of the partitioned data block
1. RAID 0:
Preparations:
Two 1G disk partitions.
[root@local ~]# mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sdb{1,2}
mdadm: /dev/sdb1 appears to contain an ext2fs file system
size=104388K mtime=Thu Jan 1 08:00:00 1970
Continue creating array? (y/n) y
Create a file system for it:
[root@local ~]# mke2fs -j /dev/md0
Mount file system:
[root@local mnt]# mount /dev/md0 /mnt/raid
View mounted file system information:
[root@local mnt]# df -h
File System Capacity Used Available % Mount Points Used
/dev/mapper/VolGroup00-LogVol00 18G 3.3G 14G 20% /
/dev/sda1 99M 13M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
/dev/sr0 3.3G 3.3G 0 100% /mnt/cdrom
.host:/ 56G 44G 12G 79% /mnt/hgfs
/dev/md0 1.9G 35M 1.8G 2% /mnt/raid
The file shown here does not appear to be 2G normally, because RAID itself has some metadata to save.
2. RAID 1:
Preparations:
Two 1G disk partitions.
[root@local ~]# mdadm -C /dev/md1 -a yes -l 1 -n 2 /dev/sdb{5,6}
view status information
[root@local ~]# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb6[1] sdb5[0]
987840 blocks [2/2] [UU]
md0 : active raid0 sdb2[1] sdb1[0]
1975744 blocks 64k chunks
unused devices:
create a file system
[root@local ~]# mke2fs -j /dev/md1
View details of a specified RAID device
[root@local ~]# mdadm -D /dev/md1
/dev/md1:
Version : 0.90
Creation Time : Tue Mar 3 17:26:24 2015
Raid Level : raid1
Array Size : 987840 (964.85 MiB 1011.55 MB)
Used Dev Size : 987840 (964.85 MiB 1011.55 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Tue Mar 3 17:30:22 2015
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
UUID : f6a3844f:282828af:45d573d8:5f0aa269
Events : 0.4
Number Major Minor RaidDevice State
0 8 21 0 active sync /dev/sdb5
1 8 22 1 active sync /dev/sdb6
Simulate a hard disk corruption (administrative mode)
[root@local ~]# mdadm /dev/md1 --fail /dev/sdb5
mdadm: set /dev/sdb5 faulty in /dev/md1
Remove damaged hard disk: (-r = --remove)
[root@local ~]# mdadm /dev/md1 -r /dev/sdb5
mdadm: hot removed /dev/sdb5
Replace the disk with a new one (the partition should be consistent with that of the broken disk)
[root@local ~]# mdadm /dev/md1 -a /dev/sdb7
mdadm: added /dev/sdb7
Stop Disk Array
[root@local ~]# mdadm -S /dev/md1
mdadm: stopped /dev/md1
Reassembling disk arrays
[root@local ~]# mdadm -A --run /dev/md1 /dev/sdb5 /dev/sdb6
mdadm: /dev/md1 has been started with 1 drive (out of 2).
Scan the information of disk array and realize automatic assembly later:
[root@local ~]# mdadm -D --scan > /etc/mdadm.conf
3. RAID 5:
Preparation: 3 512M disks
[root@local ~]# mdadm -C /dev/md5 -l5 -n3 /dev/sdb{8,9,10}
After reading the above, do you have any further understanding of RAID disk array applications? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.