Multipath配置文件详解

1 功能
Multipath简称为多路径访问,主要功能就是和存储设备一起配合实现三大功能:
1. 故障的切换和恢复
2. IO流量的负载均衡
3. 磁盘的虚拟化
2 组成
defaults
定义devices-mapper-multipath的默认设置,能被devices和multipaths部分的设置覆盖
blacklist
需要从multipath的发现中排除的设备
blacklist_exceptions
需要包括的设备,优先级大于blacklist
multipaths
定义对multipath设备的设置
devices
定义对存储控制器的设置
优先级:multipaths > devices > defaults
3 参数详解
defaults{
  user_friendly_names    yes    //若设置yes,则使用/etc/multipath/bindings中的对应绑定来命名合并路径,以mpath<n>的形式;若设置no(默认),则使用WWID来命名
  checker_timeout        20    //scsi命令路径检查超时时间,默认从/sys/block/sd<x>/device/timeout取值
  polling_interval        10    //两次路径检查的间隔时间,将逐渐增加至(4 * polling_interval),默认为5s
  queue_without_daemon    no    //若为no,则multipathd将停止已关闭设备的排队,默认为yes
  flush_on_last_del        yes    //若为yes,则multipathd将停止已删除设备最后路径的排队,默认为no
}
blacklist {
    devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"    //需排除设备的正则表达式
    devnode "^(hd|xvd)[a-z][[0-9]*]"
    devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*"
    wwid    "ATA"                                //设备的World Wide Identification
}
devices {
    device {
    vendor            "Sugon"    //厂商名称
    product            "DS800"    //产品型号
    path_grouping_policy    group_by_prio        //默认的路径组策略
    getuid_callout        "/sbin/scsi_id --whitelisted --device=/dev/%n"        //获得唯一设备号使用的默认程序,应使用绝对路径,默认为/lib/udev/scsi_id --whitelisted --device=/dev/%n
    prio            "sugon_alua"        //获取路径priority value的方法
    path_checker        tur    //决定路径状态的方法,readsector0表示Read the first sector of the device,tur表示Issue a TEST UNIT READY command to the device
    path_selector        "round-robin 0"    //选择哪条路径进行下一个IO操作的方法,由multipath target内核提供,round-robin 0表示Loop through every path in the path group, sending the same amount of IO to each
    hardware_handler    "1 alua"    //用于此存储的硬件处理程序,1 alua表示SCSI-3 ALUA arrays
    failback        immediate    //故障恢复的模式,immediate表示立即恢复到最高优先级组中的active路径;manual表示不执行自动恢复,默认为manual
    rr_weight        uniform        
    rr_min_io_rq        100        //在当前的路径组中,切换到另外一条路径之前的IO请求数目(系统内核高于2.6.31时使用,默认值为1;低于2.6.31时使用rr_min_io,默认值为1000)
    no_path_retry        queue    //在disable queue之前系统尝试使用失效路径的次数,queue表示never stop queueing,默认为0
    features        "1 queue_if_no_path"    //Queue IO if no path is active,同no_path_retry
    product_blacklist     "DS800 V-LUN"    //产品黑名单
    fast_io_fail_tmo     20        //发现问题时停止IO前的等待时间,应小于dev_loss_tmo
    dev_loss_tmo        86400    //发现问题时移除路径前的等待时间
    }
}

下面是相关参数的标准文档的介绍:

Attribute

Description

wwid

Specifies the WWID of the multipath device to which themultipath attributes apply. This parameter is mandatory for this section of themultipath.conf file.

alias

Specifies the symbolic name for the multipath device to which themultipath attributes apply. If you are usinguser_friendly_names, do not set this value tompathn; this may conflict with an automatically assigned user friendly name and give you incorrect device node names.

path_grouping_policy

Specifies the default path grouping policy to apply to unspecified multipaths. Possible values include:

failover = 1 path per priority group

multibus = all valid paths in 1 priority group

group_by_serial = 1 priority group per detected serial number

group_by_prio = 1 priority group per path priority value

group_by_node_name = 1 priority group per target node name

 

path_selector

Specifies the default algorithm to use in determining what path to use for the next I/O operation. Possible values include:

round-robin 0: Loop through every path in the path group, sending the same amount of I/O to each.

queue-length 0: Send the next bunch of I/O down the path with the least number of outstanding I/O requests.

service-time 0: Send the next bunch of I/O down the path with the shortest estimated service time, which is determined by dividing the total size of the outstanding I/O to each path by its relative throughput.

 

failback

Manages path group failback.

A value of immediate specifies immediate failback to the highest priority path group that contains active paths.

A value of manual specifies that there should not be immediate failback but that failback can happen only with operator intervention.

A value of followover specifies that automatic failback should be performed when the first path of a path group becomes active. This keeps a node from automatically failing back when another node requested the failover.

A numeric value greater than zero specifies deferred failback, expressed in seconds.

 

prio

Specifies the default function to call to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitableprio value. Possible values include:

const: Set a priority of 1 to all paths.

emc: Generate the path priority for EMC arrays.

alua: Generate the path priority based on the SCSI-3 ALUA settings.

tpg_pref: Generate the path priority based on the SCSI-3 ALUA settings, using the preferred port bit.

ontap: Generate the path priority for NetApp arrays.

rdac: Generate the path priority for LSI/Engenio RDAC controller.

hp_sw: Generate the path priority for Compaq/HP controller in active/standby mode.

hds: Generate the path priority for Hitachi HDS Modular storage arrays.

 

no_path_retry

A numeric value for this attribute specifies the number of times the system should attempt to use a failed path before disabling queueing.

A value of fail indicates immediate failure, without queueing.

A value of queue indicates that queueing should not stop until the path is fixed.

 

rr_min_io

Specifies the number of I/O requests to route to a path before switching to the next path in the current path group. This setting is only for systems running kernels older that 2.6.31. Newer systems should userr_min_io_rq. The default value is 1000.

rr_min_io_rq

Specifies the number of I/O requests to route to a path before switching to the next path in the current path group, using request-based device-mapper-multipath. This setting should be used on systems running current kernels. On systems running kernels older than 2.6.31, use rr_min_io. The default value is 1.

rr_weight

If set to priorities, then instead of sending rr_min_iorequests to a path before calling path_selector to choose the next path, the number of requests to send is determined byrr_min_io times the path's priority, as determined by theprio function. If set to uniform, all path weights are equal.

flush_on_last_del

If set to yes, then multipath will disable queueing when the last path to a device has been deleted.

更多参数解释见 https://linux.die.net/man/5/multipath.conf

4 实例

DS800-G30 redhat6.5 fc & iscsi
DS800-G30 redhat 6.5 & 7.2

 
原文地址:https://www.cnblogs.com/seaBiscuit0922/p/10393839.html