Multipath简称为多路径访问,主要功能就是和存储设备一起配合实现三大功能: 1. 故障的切换和恢复 2. IO流量的负载均衡 3. 磁盘的虚拟化

一、multipathredhat 7.2中的基本配置:

wKioL1hck-_A9WpgAADUF9Ah-cM128.png

从上面的提示可以看出,默认没有/etc/multipath,DM模块没有加载,在redhat linux 7.2可以用命令/sbin/mpathconf/  --enable 生成配置文件 

/etc/multipath.conf配置文件中内容是被注释掉的

wKiom1hclDyx0blSAAEcSNr1nl0957.png

所有要注意些,要修改的地方去掉注释;

为节省时间,下面有6.2的配置详情,和7.2差别不大

 

一、multipathredhat 6.2中的基本配置:

1. 通过命令:lsmod |grep dm_multipath  检查是否正常安装成功。如果没有输出说明没有安装那么通过yum功能安装一下软件包:yum –y install device-mapper device-mapper-multipath

接着通过命令:multipath –ll 查看多路径状态查看模块是否加载成功

[root@liujing ~]#  multipath –ll   查看多路径状态

Mar 10 19:18:28 | /etc/multipath.conf does not exist, blacklisting alldevices.

Mar 10 19:18:28 | A sample multipath.conf file is located at

Mar 10 19:18:28 |/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf

Mar 10 19:18:28 | You can run /sbin/mpathconf to create or modify/etc/multipath.conf

Mar 10 19:18:28 | DM multipath kernel driver notloaded    ----DM模块没有加载

如果模块没有加载成功请使用下列命初始化DM,或重启系统
---Use the following commands to initialize and start DM for the first time:
# modprobe dm-multipath
# modprobe dm-round-robin
# service multipathd start
# multipath –v2

初始化完了之后再通过multipath -ll命令查看是否加载成功

[root@liujing ~]#  multipath -ll

Mar 10 19:21:14 | /etc/multipath.conf does not exist, blacklisting alldevices.

Mar 10 19:21:14 | A sample multipath.conf file is located at

Mar 10 19:21:14 |/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf

Mar 10 19:21:14 | You can run /sbin/mpathconf to create or modify/etc/multipath.conf

DM multipath kernel driver not loaded    ----这个提示没了说明DM模块已加载成功。

从上面的提示可以看到,DM模块是成功加载,但是/etc/下没有multipath.conf 配置文件,下一步介绍如何配置multipath.conf 文件。

2. 配置multipath

通过vi命令创建一个Multipath的配置文件路径是/etc/multipath.conf ,在配置文件中添加multipath正常工作的最简配置如下:

vi /etc/multipath.conf

blacklist {

devnode "^sda"

}

defaults {

user_friendly_names yes

path_grouping_policy multibus

failback immediate

no_path_retry fail

}

编辑完成后保存配置,同时通过命令:

# /etc/init.d/multipathd start #开启mulitipath服务

如果出现无法开启服务的情况,没有提示OK的话如下:

[root@liujing mapper]# service multipathd start

Starting multipathd daemon:     没有提示OK

重新开关一下服务就可以解决了。

[root@liujing mapper]# /etc/init.d/multipathd stop

Stopping multipathddaemon:                                [  OK  ]

[root@localhost mapper]# /etc/init.d/multipathd start

Starting multipathddaemon:                                [  OK  ] -----提示OK 正常开启服务

通过命令查看:

[root@liujing mapper]# multipath -ll

mpatha (360a9800064665072443469563477396c) dm-0NETAPP,LUN    ----创建了一个lun

size=3.5G features='0' hwhandler='0' wp=rw

`-+- policy&#