Multipath是多路径聚合软件,用于解决SAN环境下,多条I/O路径的流量分配、路径管理.对于OS而言,每条路径都是一块物理盘,在没有多路径聚合软件的情况下,会出现实际上单一盘多链路导致系统认到多块盘的情况.多路径软件常用于故障切换和链路冗余和I\O流量的负载均衡
Multipath的应用操作:
1、查看服务进程multipathd.
[root@localhost ~]# ps -ef | grep multipathd
root 6790 1 1 Dec19 ? 02:52:54 /sbin/multipathd
root 29693 23820 0 00:11 pts/0 00:00:00 grep multipathd
|
若没有启动则执行如下命令,启动multipath服务
[root@localhost ~]# service multipathd start
|
或者
[root@localhost ~]#/etc/init.d/multipathd start
|
2、查看磁盘WWID文件/var/lib/multipath/bindings
[root@localhost ~]# cat /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
#
mpath0 36005076b08164f4077654321a3efb95fe
mpath1 3600508a4010c3a920000c00002370000
|
*注意,表中的英文提示,文件内容由multipath自动生成,一般情况下,不需要自动更改.
3、编辑multipath配置文件/etc/multipath.conf
[root@localhost ~]# cat /etc/multipath.conf
********************ignore****************************
## Use user friendly names, instead of using WWIDs as names.
defaults {
user_friendly_names yes
}
# Blacklist all devices by default. Remove this to enable multipathing
# on the default devices.
devnode_blacklist {
wwid 36005076b08164f4077654321a3efb95fe
# devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
# devnode "^hd[a-z]"
}
multipaths {
multipath {
wwid 3600508a4010c3a920000c00002370000
alias example
}
********************ignore****************************
|
说明:1、默认情况下的设备都在multipath的黑名单中,例如我们不希望本地盘被聚合,则在黑名单中绑定本地盘的wwid即可.
2、本例中,将wwid 3600508a4010c3a920000c00002370000的磁盘,绑定别名 example,默认情况下Use user friendly names没有被解注,multipath生成dm设备之后,会同时在/dev/mapper/下生成以磁盘wwid为名的符号链接指向对应的dm设备,但此例中,Use us |