欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

multipath多路径

程序员文章站 2024-01-30 15:22:40
...

20151217 Thu 北京

Install

yum install device-mapper-multipath

新添加的设备在这三个目录:

/dev/mapper/mpathN
/dev/mpath/mpathN
/dev/dm-N
The /dev/dm-N devices are internal to device mapper and should never be used. These devices are not persistent. Starting with Red Hat Enterprise Linux 5, these devices are no longer created by udev.

The /dev/mpath/mpathN devices are provided so that all the multipathed devices can be seen in one place. However, these device nodes may not be created on boot before the system needs to access them. Therefore they should not be used for creating logical volumes or filesystems.

The /dev/mapper/mpathN devices are persistent and they are created early in the boot process. Therefore these are the device names that should be used to access the multipathed devices.
/dev/mapper 中的设备是在引导过程中生成的。可使用这些设备访问多路径设备,例如在生成逻辑卷时。

/dev/mpath 中的设备是为了方便,这样可在一个目录中看到所有多路径设备。这些设备是由 udev 设备管理器生成的,且在系统需要访问它们时不一定能启动。请不要使用这些设备生成逻辑卷或者文件系统。

/dev/dm-n 格式的设备都只能是作为内部使用,且应该永远不要使用。

Configure

vim /etc/multipath.conf
multipaths {
    multipath {
        wwid 36005076801808646280000000000004e
        alias mpath1
    }
    multipath {
        wwid 36005076801808646280000000000004f
        alias mpath2
    }
}
blacklist {
       device {
               vendor  "IBM"
               product "ServeRAID M1015"
       }
    devnode "^sda"  # 将本地硬盘从多路径中排除
}

或者修改:

vim /var/lib/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
mpath1 36005076801808646280000000000004e
mpath2 36005076801808646280000000000004f
mpath3 360050768018086462800000000000050
mpath4 360050768018086462800000000000051

默认情况下,将使用 /var/lib/multipath/bindings 内的配置设定具体每个多路径设备名,如果在/etc/multipath.conf中有设定各wwid 别名,别名会覆盖此设定

Configure

modprobe dm-multipath
lsmod | grep dm_multipath
service multipathd start
chkconfig multipathd on
chkconfig --list multipathd
multipathd -F   # 清除现有路径
multipathd -v2  # 输出多路径设备的路径来显示哪些设备是多路径设备。如果没有输出任何结果,请确定正确调试了所有 SAN 连接并使系统多路径。
multipath -ll   # 查看多路径相关信息

# Oracle
修改启动权限,如果使用asmlib本步骤可以省略(用于oracle)

[[email protected] rules.d]# cat 99-grid-permissions.rules

Set permissions of block bindings to Oracle Clusterware devices

PROGRAM="/bin/chown grid:asmadmin /dev/mapper/mpath1p1"
PROGRAM="/bin/chown grid:asmadmin /dev/mapper/mpath2p1"
PROGRAM="/bin/chown grid:asmadmin /dev/mapper/mpath3p1"
PROGRAM="/bin/chown grid:asmadmin /dev/mapper/mpath4p1"


# Reference

[Linux下的多路径管理](http://blog.csdn.net/hijk139/article/details/7645383)

[多路径介绍与使用](http://blog.csdn.net/xushiyan/article/details/7082023)

[红帽](https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/5/html/DM_Multipath/index.html)