The multi-path software under Ubuntu system is the DM multipath tool that comes with the operating system.
----------------------------------------------------------------------------------------------------------- -------
Dm-multipath Component Description:
dm_multipath: kernel modules re-specify I/O for path and path groups and support for error redundancy.
multipath-tools: program configuration and enable device mapper Multipath
multipath: command lists and configures Multipath devices. It is usually started with/etc/rc.sysinit and can be started with a udev program when adding a block device.
MULTIPATHD: daemon Monitor path, if the path fails and returns, it may start the path group switch. Interactive modifications can be provided for multipath devices.
any modifications to the/etc/multipath.conf file must start it.
kpartx: command to generate device mapper devices for partitions in the device. This command is for DOS partitions with DM-MP
is very necessary. KPARTX exists in its own package, but the Devicemapper-multipath package relies on it.
----------------------------------------------------------------------------------------------------------- --------
First, check whether the system has the Multipath software package installed, if it is not found on the system installation CD and install the appropriate package.
[email protected]:~# dpkg-l | grep multipath-tools
[email protected]:~# #没有返回值说明没有安装
Ii. installing Multipath-tools and Multipath-tools-boot packages
through apt source installation, if the operating system can connect the external network through the network apt source is most convenient, if cannot connect the outside network, can carry on the local apt source installation through the DVD optical drive mount system ISO image file,
the way to mount a DVD source is an article of Ubuntu source that has been introduced here no longer introduced.
1. Search Packages
[email protected]:~# apt-cache Search Multipath-tool
kpartx-create Device mappings for partitions
multipath-tools-maintain multipath block device Access
Multipath-tools-boot-support booting from multipath devices
[Email protected]:~#
2. Install the package
[email protected]:~# apt-get Install multipath-tools
If you need to boot from a SAN, you also need to multipath-tools-boot the package, and you do not need to be able to install it.
[email protected]:~# apt-get Install multipath-tools-boot
Third, check the service boot status.
[email protected]:~# systemctl list-unit-files | grep multipath
Multipath-tools-boot.service Masked
Multipath-tools.service enabled #开机已启动
Multipathd.service enabled #开机已启动
multipathd.socket Static
[Email protected]:~#
If the service does not start, start with the following command
[email protected]:~# systemctl Enable Multipath-tools.service
Iv. Multipath need to create a profile/etc/multipath.conf, which is not by default. After installing the software
generate multipath.conf.synthetic template file in:/usr/share/doc/multipath-tools/examples directory
You can copy this file to the/etc directory and from the named Multipath.conf command as follows
[email protected]:~# cp-v/usr/share/doc/multipath-tools/examples/multipath.conf.synthetic/etc/multipath.conf
The contents of this file are commented out, you can cancel the comment of the line related to your environment
Five, modify the configuration file/etc/multipath.conf add the following content, here do not uncomment the line, add content directly
-----------------------------------------------------------------------------------
Defaults {
User_friendly_names Yes #如果是集群环境yes最好改成no, there are explanations below.
Path_grouping_policy Multibus
}
blacklist {#把本地磁盘加入黑名单, explained below
Wwid 3630001575acb87f022c3c81a046db3e4 #本地磁盘的WWid号
}
------------------------------------------------------------------------------------
You can view the Wwid number of the disk by using the following command.
[email protected]:~# ll/dev/disk/by-id/
If you find that you need to edit the multipath configuration file after you start the multipath daemon, you must execute the following command to make the change take effect.
[email protected]:~# systemctl Reload Multipathd.service
Six, the start MULTIPATHD service, the Guardian process.
[email protected] ~]# systemctl start Multipathd.service
Seven, check whether the Multipath module is loaded normally
[email protected]:~# lsmod |grep Dm_multipath
Dm_multipath 24576 2 dm_round_robin
[Email protected]:~#
Eight, after the installation configuration is successful, you can see that Multipath manages a multipath device called MPATHN, which contains two paths.
[email protected]:~# multipath-ll #user_friendly_names Yes (alias setting)
Mpatha (36505dac1002fc54b1ee508f200000048) dm-0 HUAWEI,XSG1
size=200g features= ' 0 ' hwhandler= ' 0 ' wp=rw
'-+-policy= ' round-robin 0 ' prio=1 status=active
|-12:0:0:1 SDB 8:16 active ready running
'-13:0:0:1 SDC 8:32 active ready running
[email protected]:~# multipath-ll #user_friendly_names No (alias setting)
36505dac1002fc54b1ee508f200000048 dm-0 HUAWEI,XSG1
size=200g features= ' 0 ' hwhandler= ' 0 ' wp=rw
|-+-policy= ' round-robin 0 ' prio=1 status=active
| '-12:0:0:1 SDB 8:16 active ready running
'-+-policy= ' round-robin 0 ' prio=1 status=enabled
'-13:0:0:1 SDC 8:32 active ready running
nine, using Fdisk to view the hard disk will be more than the storage device Disk/dev/mapper/mpatha (alias), this is a multi-path software generation device, in the partition or other for the operation of the hard disk use this device, do not use/DEV/SDB and/dev/ SDC and other devices, unless it is a server local disk (SDA).
[email protected]:~# fdisk-l
disk/dev/sdb:200 GiB, 214748364800 bytes, 419430400 sectors
units:sectors of 1 * bytes
Sector Size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
disk/dev/sdc:200 GiB, 214748364800 bytes, 419430400 sectors
units:sectors of 1 * bytes
Sector Size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
disk/dev/mapper/mpatha:200 GiB, 214748364800 bytes, 419430400 sectors
units:sectors of 1 * bytes
Sector Size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
[Email protected]:~#
10, to modify the configuration file multipath.conf Add the following content description
-----------------------------------------------------------------------------------------
1, user_friendly_names Yes
each multipath device has a global identifier (WWID), which is the only number in the world that cannot be changed. By default, the
The name of the multipath device is set to its WWID. In addition, you can also set up in a multipath configuration file
user_friendly_names option, which sets the alias to a node unique name in the format mpathn
When new devices are added to Dm-multipath, these new devices will be located in the two different bits of the/dev directory
Set :/dev/mapper/mpathn and/dev/dm-n.
The devices in the/dev/mapper are generated during the boot process. You can use these devices to access multipath devices, such as when generating
logical volume.
all devices in the/DEV/DM-N format can only be used as internal, and do not use them.
* Keep multipath device names consistent in the cluster (focus)
When the user_friendly_names configuration option is set to Yes, the name of the multipath device is unique to the node, but does not
ensure that all nodes that use multipath devices are consistent. Similarly, if you are multipaths for the multipath.conf configuration file
section, set the alias option, which is not automatically consistent across all nodes in the cluster. If you are using LVM in a multi-channel
to create logical devices in the path device, this should not be a problem. But if you need to keep your multipath device name on every node in the cluster
Please do not set the User_friendly_names option to Yes, and do not configure aliases for those devices. Default Condition
If you do not set User_friendly_names to Yes, or if you configure an alias for a device, the device name will be the
WWID, it will not change.
If you want the system-defined user-friendly name to be consistent across all nodes in the cluster, you can follow these steps:
1. Set all multipath devices in a single machine.
2. Run the following command to disable all multipath devices in other machines:
# systemctl Stop Multipath-tools.service
# multipath-f
3. Copy the/etc/multipath/bindings file from the first machine to all other machines in the cluster.
4. Use the following command to re-multipathd the daemon in other machines in the cluster:
Device Map Multipathing
# systemctl Start Multipath-tools.service
If you add a new device, you will need to repeat the process.
Similarly, if you configure an alias for a device so that it remains consistent across the nodes in the cluster, you should determine
The /etc/multipath.conf file is the same for each node in the cluster, with the following steps:
1. Configure aliases for multi-roadbed functional devices in the machine multipath.conf file.
2. Run the following command to disable all multipath devices in other machines:
# systemctl Stop Multipath-tools.service
# multipath-f
3. Copy the/etc/multipath.conf file from the first machine to all other machines in the cluster.
4. Use the following command to re-multipathd the daemon in other machines in the cluster:
# systemctl Start Multipath-tools.service
When you add a new device, you will need to repeat the process.
-----------------------------------------------------------------------------------------------
2, Path_grouping_policy Multibus
the Dm-multipath provides error redundancy in an active/passive configuration. In an active/passive configuration, only half of the paths are in each
I/O is used. If any element of the I/O path (cable, switch, or controller) fails, the Dmmultipath is switched to the alternate path.
The Dm-multipath can also be configured as an active/active mode, where I/O is distributed across all paths in the form of a round call scheduling algorithm.
In some configurations, the Dm-multipath can detect the load and dynamically rebalance the load in the I/O path
default configuration path_grouping_policy failover main Standby mode
configured as Path_grouping_policy multibus load mode
3. Ignore local disk when generating multipath devices
Some machines have local SCSI cards on their internal disks. Dm-multipath is not recommended for these devices. The following procedure shows how to modify a multipath configuration file to ignore a local disk when configuring Multipathing.
determine which disks are internal and mark them as disks to be blacklisted. In general,/DEV/SDA is an internal disk.
to prevent the device mapper from mapping/DEV/SDA in its multipath mapping, edit the blacklist portion of the/etc/multipath.conf file to include this device.
Although you can blacklist SDA devices using the devnode type, this is not a secure process because/DEV/SDA cannot guarantee the same on reboot.
to blacklist a single device, you can use the device's Wwid to blacklist it.
11. Common Commands
# multipath-ll #显示现有多路径配置
# multipath-f #删除全部路径
# Multipath-v2 #格式化路径, a new path is generated after formatting
Multi-path software DM Multipath configuration under Ubuntu System.