As a DBA, choosing what your data is stored on should be the most basic thing. But many DBAs are easy to ignore this, I am one of them. I didn't know much about raid before. This article records the knowledge about raid learning.
First, the basic knowledge of RAID[Definition] RAID (Redundant Array of Independent Disk) is an independent redundant disk array.
1. Why use RAID?
We know that a single disk has a single point of problem in terms of performance, capacity, and security. If multiple hard disks are grouped into a group, it can be used as a logical drive to access data from multiple hard disks at the same time. It can increase the storage throughput while also increasing access speed and expanding storage capacity.
RAID (Redundant Array of Independent Disk) technology is dedicated to this. RAID is a redundant array of multiple inexpensive disks that appear as a separate large storage device under the operating system. RAID can take full advantage of multiple hard disks, increase the speed of the hard disk, increase the capacity, provide fault-tolerant functions to ensure data security, and easy management. You can continue to work if there is any problem with any hard disk. This is necessary for the database storage area due to the impact of the damaged hard disk.
2, several working levels of RAID
Our more common RAID levels are RAID-0, RAID-1, RAID-10/RAID-01, RAID-5. Others such as RAID-3, RAID-4, and RAID-6 are not covered here.
RAID-0
RAID-0 uses Striped to cascade multiple disks into a larger disk group, which improves disk performance and throughput. It reads and writes data at the fastest speed, requires less, requires two disks to do RAID-0, and the relative cost is the lowest, but RAID-0 does not provide redundancy or parity data if the drive In the event of a failure, the data will not be recovered and the security will be the weakest. Generally, it is only used when the performance requirements are high and the data security requirements are not high. It is not suitable for database storage.
RAID-1
RAID-1 uses mirrored (redundant) data. RAID-1 requires at least two or 2xN disks and is written to the mirror at the same time each time data is written. This array is highly reliable, but its effective capacity is reduced to half of the total capacity, and the size of these disks should be equal, otherwise the total capacity will only have the smallest disk size. RAID-1 data security is best at all RAID levels. However, its disk utilization is only 50%, which is the lowest of all RAID levels.
RAID-10
Because RAID-0 and RAID-1 have obvious advantages and disadvantages, in order to combine the advantages of both and avoid the disadvantages of both, RAID-10 is produced. RAID-10 is suitable for high speed and full fault tolerance. Of course, the cost is also a lot of applications. However, when doing RAID-10, you need to pay attention to RAID-1 first, then RAID-0 or RAID-0 first, and then RAID-1. There is still a difference between the two. Give a chestnut, if there are now four disks:
Do RAID-0 first, then RAID-1: RAID-0 is used for every two disks. On this basis, two RAID-0s are made into RAID-1. At this time, if a Class A or Class B disk has a failure at the same time, the entire RAID will not be available.
(RAID 0) A = (Drive A1 + Drive A2) (Striped)
(RAID 0) B = (Drive B1 + Drive B2) (Striped)
(RAID-1) AB = (A + B) (Mirrored)
Do RAID-1 first, then RAID-0: RAID-1 is used for every two disks. On this basis, two RAID-1s are made into RAID-0. At this time, only the Class A or Class B disks fail, and the entire RAID is not available.
(RAID-1) A = (Drive A1 + Drive A2) (Mirrored)
(RAID-1) B = (Drive B1 + Drive B2) (Mirrored)
(RAID-0) AB = (A + B) (Striped)
In summary, it is relatively safer to do RAID-1 first and then RAID-0. This is the recommended way, so we usually say RAID-10 first, then RAID-0.
RAID-5
RAID-5 should be in a working mode between RAID-0 and RAID-1. It tries to balance the advantages and disadvantages of RAID-0 and RAID-1. It is a mode that we usually use more. To do RAID-5, you need at least three disks. It uses checksum redundancy data. The verification information is distributed on multiple disks. When data is written to disk every time, you need to write verification information, so write Incoming performance is relatively inferior to RAID-0. When a disk fails, you can use other checksum information on the disk to recover the data. Relative to RAID-1, its disk space utilization is (N-1)/N
3, RAID work level advantages and disadvantages
[Note] The above high, medium and low are only relative to RAID-0, RAID-1, RAID-10, and RAID-5.
Second, how to determine the RAID level, write strategy, battery status1. Determine the RAID level: The input information of the MegaCli64 tool is as follows:
[root()@xxxx ~]# MegaCli64 -LdInfo -lAll -aALL
Adapter 0 -- Virtual Drive InformaTIon:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 278.875 GB
Is VD emulated : No
Mirror Data : 278.875 GB
State : OpTImal
Strip Size : 64 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disabled
EncrypTIon Type : None
Default Power Savings Policy: Controller Defined
Current Power Savings Policy: None
Can spin up in 1 minute: Yes
LD has drives that support T10 power condiTIons: Yes
LD's IO profile supports MAX power savings with cached writes: No
Bad Blocks Exist: No
PI type: No PI
Is VD Cached: No
Virtual Drive: 1 (Target Id: 1)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 2.180 TB
Is VD emulated : Yes
Mirror Data : 2.180 TB
State : Optimal
Strip Size : 64 KB
Number Of Drives per span : 2
Span Depth : 3
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disabled
Encryption Type : None
Default Power Savings Policy: Controller Defined
Current Power Savings Policy: None
Can spin up in 1 minute: No
LD has drives that support T10 power conditions: No
LD's IO profile supports MAX power savings with cached writes: No
Bad Blocks Exist: No
PI type: No PI
Is VD Cached: No
Some people on the Internet only judge by Primary-1, Secondary-0, RAID Level Qualifier-0 in the RAID Level column. I don't think it is very accurate. First, let's understand the Primary, Secondary, and RAID Level Qualifier.
Primary field: Basically, the level of RAID can be determined, but it is impossible to distinguish between RAID-1 and RAID-10, because in some cases their Primary values ​​are Primary-1, Secondary-0, RAID Level Qualifier-0
How do you distinguish between RAID-1 and RAID-10 in this case? I think we have to judge in combination with the other two columns:
Number Of Drives per span : 2 #2 disks per section
Span Depth : 3 #一共三段
Combined with primary-1, the RAID represents a total of six disks, each of which is RAID-1, and finally three RAID-1 RAID-0
[Summary: How to judge the RAID level]:1) In addition to RAID-1 and RAID-10, other levels can be judged by the value of the Primary field;
2) As for RAID-1 and RAID-10, you need to combine the values ​​of Number Of Drives (per span) and Span Depth. If the Span Depth value is 1 for RAID-1, not 1 for RAID-10. There is a case: Primary-1, Secondary-3, RAID Level Qualifier-0 also means RAID-10;
2, determine the RAID write strategy and battery status
RAID write strategies have a large impact on IO performance and there are two write strategies:
WriteBack: indicates that the write is to the disk cache, and the write performance is good. If this strategy is adopted, the RAID must support the battery, otherwise the data will be lost once the breakpoint is reached.
WriteThrough: indicates that it is directly written to the hard disk. The write performance is not as good as WriteBack. Generally, this strategy is adopted when there is no battery.
2.1) View RAID write strategy
[root()@xxxx ~]# MegaCli64 -LDInfo -Lall -aALL|grep 'Cache Policy'
************************************************** ********************************
Default Cache Policy: WriteBack, ReadAdaptive, Direct, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAdaptive, Direct, Write Cache OK if Bad BBU
The above indicates that the WriteBack (write-back) strategy is adopted, and if the battery is broken, it is forced to write to the cache.
Default Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
If this is the case, it means using the WriteThrough policy.
Disk Cache Policy : Disabled # indicates the cache of the hard disk, which is generally disabled here to prevent data loss.
Copy code
2.2) Check the battery status
[root()@xxxx ~]# MegaCli64 -adpbbucmd -aall |grep -E 'Battery State|Charger Status|isSOHGood|Relative State of Charge'
Battery State : Operational #Battery status, operational means running
Relative State of Charge: 98 % #Battery power, if it is lower than 15%, then the write strategy will change from WB to WC, IO performance will decline, need to pay attention
Charger Status: Complete #Charging status, indicating completed
isSOHGood: Yes #ä¸Yes need attention
Third, MySQL suitable RAID storage solutionThrough the above understanding of RAID, we already know the advantages and disadvantages of RAID at all levels. For the storage of MySQL database, how to choose RAID level?
We can choose according to various file types of MySQL. The important file types of MySQL database are:
1, data files (frm, ibd): storage core data, very important, high security requirements, while requiring frequent writes, update data, disk performance requirements are also relatively high, first suggest that the physical disk is SSD, for RAID Select, if the budget is sufficient, RAID-10 is recommended, followed by RAID-5
2, binary log file: write very frequently, write performance requirements, because the library depends on the file, security is also very important, comprehensive cost considerations, you can use two SATA hard drives, RAID-1 can be made.
3, redo file, shared table space file: high security requirements, if the budget is sufficient, RAID-10, usually RAID-1 is also possible, in general, redo files and shared table space and data files can be stored together.
BIOTEPT motor Cost effective and food safe. Stainless steel IEC motors from BIOTEPT excel in power, efficiency and food safety. With the IEC stainless steel motors you benefit from a cost-effective and food-safe drive that is suitable for applications where hygiene plays an important role.
DAYTON, LEESON, MARATHON MOTORS and U.S. MOTORS
IEC Serie – IEC Stainless Steel Motors: main features
- Smooth surface for easy cleansing (AISI 304)
- Standard IEC sizes for wide range of applications
- Encapsulated terminal boxminal box
- Motor data engraved in the housing
- Protection class IP69K and without fan (T.E.N.V.) and TEFCup to 10kW
- IE4 to meet the European energy efficiency regulations
- B3. B14.B5.B35 Accept. IP55 protection class
Iec Stainless Steel Motor,Waterproof Electric Motor,Waterproof Motor,Water Resistant Motor
Ningbo Biote Mechanical Electrical Co.,Ltd , https://www.biotept.com