码迷,mamicode.com
首页 > 其他好文 > 详细

RHEL5 多路径配置

时间:2015-04-14 19:59:32      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:rhel5   multipath   多路径   

1     检查软件包是否安装

[root@pcvmaster ~]# rpm -qa|grep device-mapper

device-mapper-libs-1.02.74-10.el6.x86_64

device-mapper-event-libs-1.02.74-10.el6.x86_64

device-mapper-multipath-0.4.9-56.el6.x86_64

device-mapper-1.02.74-10.el6.x86_64

device-mapper-event-1.02.74-10.el6.x86_64

device-mapper-multipath-libs-0.4.9-56.el6.x86_64

2     安装multipath

[root@pcvmaster ~]# yum -yinstall multipath

3     开机启动

[root@pcvmaster ~]# chkconfigmultipathd on

4     编辑multipath配置文件

vi /etc/multipath.conf

# This is a basicconfiguration file with some examples, for device mapper

# multipath.

# For a complete list of thedefault configuration values, see

#/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults

# For a list of configurationoptions with descriptions, see

#/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated

#

# REMEMBER: After updatingmultipath.conf, you must run

#

# service multipathd reload

#

# for the changes to takeeffect in multipathd

 

## By default, devices withvendor = "IBM" and product = "S/390.*" are

## blacklisted. To enablemulitpathing on these devies, uncomment the

## following lines.

#blacklist_exceptions {

#      device {

#             vendor "IBM"

#             product "S/390.*"

#      }

#}

 

## Use user friendly names,instead of using WWIDs as names.

defaults {

       user_friendly_names yes

}

##

## Here is an example of howto configure some standard options.

##

#

#defaults {

#      udev_dir              /dev

#      polling_interval      10

#      selector              "round-robin0"

#      path_grouping_policy  multibus

#      getuid_callout        "/lib/udev/scsi_id--whitelisted --device=/dev/%n"

#      prio                  alua

#      path_checker          readsector0

#      rr_min_io             100

#      max_fds               8192

#      rr_weight             priorities

#      failback              immediate

#      no_path_retry         fail

#      user_friendly_names   yes

#}

##

## The wwid line in thefollowing blacklist section is shown as an example

## of how to blacklistdevices by wwid.  The 2 devnode lines arethe

## compiled in defaultblacklist. If you want to blacklist entire types

## of devices, such as allscsi devices, you should use a devnode line.

## However, if you want toblacklist specific devices, you should use

## a wwid line.  Since there is no guarantee that a specificdevice will

## not change names on reboot(from /dev/sda to /dev/sdb for example)

## devnode lines are notrecommended for blacklisting specific devices.

##

#blacklist {

#       wwid 26353900f02796769

#      devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"

#      devnode "^hd[a-z]"

#}

#multipaths {

#      multipath {

#             wwid                  3600508b4000156d700012000000b0000

#             alias                 yellow

#             path_grouping_policy  multibus

#             path_checker          readsector0

#             path_selector         "round-robin0"

#             failback              manual

#             rr_weight             priorities

#             no_path_retry         5

#      }

#      multipath {

#             wwid                  1DEC_____321816758474

#             alias                 red

#      }

#}

#devices {

#      device {

#             vendor                "COMPAQ  "

#             product               "HSV110(C)COMPAQ"

#             path_grouping_policy  multibus

#             getuid_callout         "/lib/udev/scsi_id --whitelisted --device=/dev/%n"

#             path_checker          readsector0

#             path_selector         "round-robin0"

#             hardware_handler      "0"

#             failback              15

#             rr_weight             priorities

#             no_path_retry         queue

#      }

#      device {

#             vendor                "COMPAQ  "

#             product               "MSA1000         "

#             path_grouping_policy  multibus

#      }

#}

 

blacklist {

devnode"^(ram|raw|loop|fd|md|dm-|sr|sr|scd|st)[0-9]*"

devnode"^hd[a-z]"

}

devices {

device {

vendor"Netapp"

path_grouping_policymultibus

features "1queue_if_no_path"

path_checkerreadsector()

failback immediate

}

}

5     启动服务

[root@pcvmaster ~]#/etc/init.d/multipathd start

6     删除现有没有使用的路径

[root@pcvmaster ~]# multipath–F

7     格式化路径,检测路径,合并路径

[root@pcvmaster ~]# multipath-v2

8     查看多路径状态

[root@pcvmaster ~]# multipath–ll

9     重启系统

[root@pcvmaster ~]# reboot

10创建PV多块磁盘,

[root@pcvmaster ~]# pvcreate/dev/mapper/mpath{d,f,e,p,t,k,j,c,s,q}

11添加多块磁盘到Volbackup

[root@pcvmaster~]# vgcreateVolbackup /dev/mapper/mpath{d,f,e,p,t,k,j,c,s,q}

12创建LV

[root@pcvmaster ~]# lvcreate-l 1310780 -n LogVol01 Volbackup

13格式化LV

[root@pcvmaster ~] mkfs.ext4/dev/Volbackup/LogVol01

14挂载

[root@pcvmaster ~]# mount/dev/Volbackup/LogVol01 /backup

15FAQ

15.1  模块没有加载成功后

如果模块没有加载成功请使用下列命初始化DM,或重启系统

---Use thefollowing commands to initialize and start DM for the first time:

# modprobedm-multipath

# modprobe dm-round-robin

# servicemultipathd start

# multipath –v2

15.2  multipath原理介绍

1、device-mapper-multipath:即multipath-tools。主要提供multipathd和multipath等工具和 multipath.conf等配置文件。这些工具通过device mapper的ioctr的接口创建和配置multipath设备(调用device-mapper的用户空间库。创建的多路径设备会在/dev/mapper中)。

 

2、device-mapper:主要包括两大部分:内核部分和用户部分。内核部分主要由device mapper核心(dm.ko)和一些target driver(md-multipath.ko)。核心完成设备的映射,而target根据映射关系和自身特点具体处理从mappered device 下来的i/o。同时,在核心部分,提供了一个接口,用户通过ioctr可和内核部分通信,以指导内核驱动的行为,比如如何创建mappered device,这些divece的属性等。linux device mapper的用户空间部分主要包括device-mapper这个包。其中包括dmsetup工具和一些帮助创建和配置mappered device的库。这些库主要抽象,封装了与ioctr通信的接口,以便方便创建和配置mappered device。multipath-tool的程序中就需要调用这些库。

 

3、dm-multipath.ko和dm.ko:dm.ko是devicemapper驱动。它是实现multipath的基础。dm-multipath其实是dm的一个target驱动。

 

4、scsi_id:包含在udev程序包中,可以在multipath.conf中配置该程序来获取scsi设备的序号。通过序号,便可以判断多个路径对应了同一设备。这个是多路径实现的关键。scsi_id是通过sg驱动,向设备发送EVPD page80或page83 的inquery命令来查询scsi设备的标识。但一些设备并不支持EVPD 的inquery命令,所以他们无法被用来生成multipath设备。但可以改写scsi_id,为不能提供scsi设备标识的设备虚拟一个标识符,并输出到标准输出。multipath程序在创建multipath设备时,会调用scsi_id,从其标准输出中获得该设备的scsi id。在改写时,需要修改scsi_id程序的返回值为0。因为在multipath程序中,会检查该直来确定scsi id是否已经成功得到。


本文出自 “lose” 博客,请务必保留此出处http://blove.blog.51cto.com/3116850/1632364

RHEL5 多路径配置

标签:rhel5   multipath   多路径   

原文地址:http://blove.blog.51cto.com/3116850/1632364

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!