Use the mpath Device
After the multiing is generated using multipath, multiple devices pointing to the same link will be generated in the/dev directory:
/Dev/mapper/mpathn
/Dev/mpath/mpathn
/Dev/dm-n
However, their sources are completely different:
/Dev/mapper/mpathn is a multi-path device virtualized by multipath. We should use this device;
/Dev/mpath/mpathn is created by the udev Device Manager. It actually points to the following dm-n device. It can only be mounted for convenience;
/Dev/dm-n is used inside the software. It cannot be used outside of the software and cannot be mounted.
Simply put, we should use the device character under/dev/mapper. You can use fdisk to partition the device or create a pv.
Test the multpath path
Then, use iostat to observe the traffic and status of each channel to determine whether the Failover or load balancing mode is normal:
# Dd if =/dev/zero of =/dev/mapper/mpath0
# Iostat-k 2
Fault Tolerance mode:
When the mpath18 device reads and writes data, sdaf and sdv are both active and have data streams. However, the link consisting of sdb and sdl is enabled, which is used as ready. This is the case of Failover (Master/Slave ).
Modify the multi-path Mode
By default, multipath supports most common storage models (see multipath. conf. defaults), but different versions of multipath may be different. At this time, we recommend that you refer to the storage official documentation:
In the previous configuration, We have configured the default path_grouping_policy for multibus in/etc/mulitpha. conf. However, if more than one storage device is connected to the same machine, the default rules may not apply completely. At this time, we can customize multi-path matching policies for specific storage.
Devices {
Device {
Vendor "HITACHI" // vendor name
Product "OPEN-V" // product Model
Path_grouping_policy group_by_prio // default path Group Policy
Path_grouping_policy failover
# Getuid_callout "/sbin/scsi_id-p 0x80-g-u-s/block/% n" // obtain the default program used by the unique device number
Path_checker readsector0 // Method for Determining the path status
Path_checker tur
Path_selector "round-robin 0" // Method for Selecting the path to perform the next IO operation
Prio_callout "/sbin/mpath_prio_alua/dev/% n" // gets the default program used by a finite value.
Failback immediate // fault recovery mode
# Hardware_handler "0" // The module used to perform specific operations in case of path switching or IO errors.
# No_path_retry queue // number of times the system attempted to use the invalidation path before disablequeue
# Rr_min_io 100 // Number of IO requests before switching to another path in the current user group
}
}
※Do not write an error path_checker (possible values: readsector0, tur, emc_clariion, hp_sw, directio ). You can refer to the official Storage Materials for details.
Troubleshooting Process
# Multipath-v3-ll
# Dmsetup ls
# Multipathd-k
> Show config
> Reconfigure
> Show paths
> CTRL-D
/Var/lib/multipath/bindings
/Dev/mapper/
# Cat/sys/block/sda/device/vendor
# Cat/sys/block/sda/device/model
※Note:
/Var/lib/multipath/bindings displays wwid in the blacklist. The mpathn sequence may be different from the multipath-ll result. Actually, the result of multipath-ll is available.
Path Switching
Custom Device
※Note: 1. After binding, You need to regenerate the path ing table. 2. When you bind the wwid, devices that are not bound will not be available, you cannot see these devices with-ll, but they are visible in/var/lib/multipath/bindings.
Start the service and generate the ing
# Modprobe dm-multipath
# Service multipathd start
# Multipath-v0
Update the config file
When you update/Etc/multipath. confAfter the file, you must manuallyM ultipathdThe daemon reloads the file. The following command can re-load the updated/Etc/multipath. confFile.
#Servicemultipathd reload