本文共 3806 字,大约阅读时间需要 12 分钟。
相信做过Mutipath Device的童鞋对multipath.conf并不陌生。不错,这个是DM的配置文件。初次配置DM可以不修改配置文件中的任何内容,它会默认加载,当然用的参数也是默认的。有些时候我们的存储并不支持默认的配置,或者默认的配置并不适合存储的需求,这就需要对默认的参数做些修改。
下面看一下默认mutipath.conf的内容:
[root@ProsDB01 etc]# more multipath.conf # This is a basic configuration file with some examples, for device mapper # multipath. # For a complete list of the default configuration values, see # /usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.defaults # For a list of configuration options with descriptions, see # /usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.annotated
# Blacklist all devices by default. Remove this to enable multipathing # on the default devices. blacklist { devnode "*" }## By default, devices with vendor = "IBM" and product = "S/390.*" are ## blacklisted. To enable mulitpathing 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 how to configure some standard options. ## # #defaults { # udev_dir /dev # polling_interval 10 # selector "round-robin 0" # path_grouping_policy multibus # getuid_callout "/sbin/scsi_id -g -u -s /block/%n" # prio_callout /bin/true # 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 the following blacklist section is shown as an example ## of how to blacklist devices by wwid. The 2 devnode lines are the ## compiled in default blacklist. If you want to blacklist entire types ## of devices, such as all scsi devices, you should use a devnode line. ## However, if you want to blacklist specific devices, you should use ## a wwid line. Since there is no guarantee that a specific device will ## not change names on reboot (from /dev/sda to /dev/sdb for example) ## devnode lines are not recommended 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-robin 0" # 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 "/sbin/scsi_id -g -u -s /block/%n" # path_checker readsector0 # path_selector "round-robin 0" # hardware_handler "0" # failback 15 # rr_weight priorities # no_path_retry queue # } # device { # vendor "COMPAQ " # product "MSA1000 " # path_grouping_policy multibus # } #}
其中包含了几项参数:blacklist、defaults、multipaths、devices。这些参数对多路径的初始化信息起着决定性的作用。
这里简单介绍下这个参数的作用,详细内容可参见官方文档:。
1、blacklist
这个参数用作排除磁盘的。有些磁盘比如本地盘已经做了Raid,这里就需要将本地盘和光驱设备排除,不配置多路径。语法格式配置文件中也有,一般情况sda是作为本地磁盘:
blacklist { devnode "^sda" }
当然,官方的建议还是采用WWID排除的方式,因为有些时候本地盘不只一个,名字也容易发生变化。
blacklist { wwid 26353900f02796769 # devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" # devnode "^hd[a-z]" }
WWID号可以通过multipath -ll查看,或者
/sbin/scsi_id -g -s /block/sdb
2、defaults
这个参数是个全局参数,如果设置了,针对所有的盘是生效的。
3、multipaths
这个参数是针对一个盘的,配置一个盘得相关属性
4、devices
这个参数是针对设备的,不同存储对应不同的vendor。有些时候存储上的盘并不能被DM识别到,需要在devices参数中加入存储相关的参数。优先级要高于multipaths,比如path_grouping_policy在multipath设置为multibus,而在devices中设置为failover,那么生效的是failover。
这些了解了再看一下具体的参数,虽然很多,需要改动的很少。下面是比较重要的2个参数:
path_grouping_policy
这个参数常用的两个:multipath failover,前者做负载均衡,后者是主备方式
path_checker
这个参数要根据存储类型来定。常见的几种:readsector0, tur, emc_clariion, hp_sw, directio。
本文转自einyboy博客园博客,原文链接:http://www.cnblogs.com/einyboy/archive/2012/12/13/2817081.html,如需转载请自行联系原作者。