DM 多路径
Red Hat Enterprise Linux 5
DM 多路径配置及管理
版 3
摘要
本书提供了使用红帽企业版 Linux 5 设备映射器多路径特性的信息
前言
本书论述了 RHEL 5 发行本中红帽企业版 Linux 设备映射器多路径(DM-Multipath)的特性。
1. 读者 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
本书主要供管理运行了 Linux 操作系统的系统管理员使用,需要熟悉红帽企业版 Linux。
2. 相关文档 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
有关使用红帽企业版 Linux 的详情请参考以下资源:
- 《红帽企业版 Linux 安装指南》 — 提供与安装Red Hat Enterprise Linux 5 有关的信息。
- 《红帽企业版 Linux 部署指南》 — 提供有关部署、配置和管理红帽企业版 Linux 5 的信息。
有关Red Hat Enterprise Linux 5 Red Hat Cluster Suite的信息请参考以下资源:
- 《Red Hat Cluster Suite总览》 — 提供红帽群集套件的高级总览。
- 《配置和管理红帽群集》 — 提供关于安装、配置以及管理红帽群集组件的信息。
- LVM Administrator's Guide: Configuration and Administration — Provides a description of the Logical Volume Manager (LVM), including information on running LVM in a clustered environment.
- 《全局文件系统:配置及管理》 — 提供有关安装、配置和维护红帽 GFS(红帽全局文件系统)的信息。
- 《全局文件系统 2:配置及管理》 — 提供有关安装、配置和维护红帽 GFS2(红帽全局文件系统 2)的信息。
- 《使用带全局文件系统的 GNBD》 — 提供使用带红帽 GFS 的全局网络块设备的总览。
- 《Linux 虚拟服务器管理》 — 提供使用 Linux 虚拟服务器(LVS)配置高性能系统以及服务的信息。
- 《红帽群集套件发行注记》 — 提供有关现有红帽群集套件发行注记的信息。
Red Hat Cluster Suite文档以及其它 Red Hat 文档请参考Red Hat Enterprise Linux 文档光盘和 http://www.redhat.com/docs/ 中的在线文档,其中包括 HTML、PDF 以及 RPM 版本。
3. 反馈 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
如果你发现了排印错误或者有改进本文档的建议,我们希望能听取你的意见。请在 Bugzilla(http://bugzilla.redhat.com/bugzilla/)中根据组件
rh-cs 提交报告。
Be sure to mention the manual's identifier:
Bugzilla component: Documentation-cluster Book identifier: DM_Multipath(EN)-5 (2009-01-06T15:35)
Bugzilla component: Documentation-cluster
Book identifier: DM_Multipath(EN)-5 (2009-01-06T15:35)
By mentioning this manual's identifier, we know exactly which version of the guide you have.
如果你有改进本文档的建议,请尽量具体说明。如果你发现了错误,请指出章节号以及其上下文,以便我们尽快找到并更正该错误。
多路径设备映射器(DM-Multipath)允许您将服务器节点和存储阵列间的多个 I/O 路径配置为一个单一设备。这些 I/O 路径是可包含独立电缆、交换机以及控制器的物理设备。多路径集合了 I/O 路径,并生成一个包整合路径的新设备。
1.1. DM-Multipath 总览 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
可使用 DM-Multipath 提供:
- 冗余DM-Multipath 可在主动/被动配置中提供出错冗余。在主动/被动配置中,只有一半的路径在每次 I/O 时都使用。如果 I/O 路径的任意元素(电缆、交换机或者控制器)出现故障,就会将 DM-Multipath 切换到备用路径。
- 提高的性能DM-Multipath 可配置为主动/主动模式,其中将 I/O 以调度算法方式分布到所有路径中。在有些配置中,DM-Multipath 可在 I/O 路径中检测负载并动态对负载进行再平衡。
图 1.1 “Active/Passive Multipath Configuration with One RAID Device” shows an active/passive configuration with two I/O paths from the server to a RAID device. There are 2 HBAs on the server, 2 SAN switches, and 2 RAID controllers.
图 1.1. Active/Passive Multipath Configuration with One RAID Device
在这个配置中,一个 I/O 路径通过 hba1、SAN1 以及控制器 1。第二个 I/O 路径通过 hba2、SAN2 以及控制器 2。在这个配置中有很多地方可能导致故障:
- HBA 故障
- FC 电缆故障
- SAN 交换机故障
- 阵列控制器端口故障
如果配置了 DM-Multipath,在所有这些地方出现故障时都会使 DM-Multipath 切换到备用 I/O 路径。
图 1.2 “Active/Passive Multipath Configuration with Two RAID Devices” shows a more complex active/passive configuration with 2 HBAs on the server, 2 SAN switches, and 2 RAID devices with 2 RAID controllers each.
图 1.2. Active/Passive Multipath Configuration with Two RAID Devices
In the example shown in 图 1.2 “Active/Passive Multipath Configuration with Two RAID Devices”, there are two I/O paths to each RAID device (just as there are in the example shown in 图 1.1 “Active/Passive Multipath Configuration with One RAID Device”). With DM-Multipath configured, a failure at any of the points of the I/O path to either of the RAID devices will cause DM-Multipath to switch to the alternate I/O path for that device.
图 1.3 “Active/Active Multipath Configuration with One RAID Device” shows an active/active configuration with 2 HBAs on the server, 1 SAN switch, and 2 RAID controllers. There are four I/O paths from the server to a storage device:
- hba1 到控制器 1
- hba1 到控制器 2
- hba2 到控制器 1
- hba2 到控制器 2
在这个配置中,可将 I/O 分布到那四条路径中。
图 1.3. Active/Active Multipath Configuration with One RAID Device
1.2. 存储阵列支持 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
By default, DM-Multipath includes support for the most common storage arrays that support DM-Multipath. The supported devices can be found in the
multipath.conf.defaults file. If your storage array supports DM-Multipath and is not configured by default in this file, you may need to add them to the DM-Multipath configuration file, multipath.conf. For information on the DM-Multipath configuration file, see 第 4 章 DM-Multipath 配置文件.
有些存储阵列需要对 I/O 错误和路径切换的特殊处理。这些要求独立于硬件处理器内核模块。
1.3. DM-Multipath 组件 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
表 1.1 “DM-Multipath 组件”. describes the components of DM-Multipath.
| 组件 | 描述 |
|---|---|
dm-multipath kernel module | 为路径和路径组群重新指定 I/O 并支持出错冗余。 |
multipath command | 列出并配置多路径设备。通常从 /etc/rc.sysinit 开始,还可以使用 udev 程序随时添加块设备,或者可用 initramfs 文件系统运行。 |
multipathd daemon | 监视路径,如果路径故障并返回,它可能会启动路径组群切换。可为多路径设备提供互动修改。对 /etc/multipath.conf 文件的任何修改都必须启动它。 |
kpartx command | 为设备中的分区生成设备映射器设备。这个命令对带 DM-MP 的 DOS 分区是很必要的。kpartx 在其自身软件包中就存在,但 device-mapper-multipath 软件包要依赖它。 |
1.4. DM-Multipath 安装总览 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
DM-Multipath 包含适用于通用多路径配置的内置默认设置。安装 DM-multipath 通常很简单。
以下是为您的系统配置 DM-multipath 的基本步骤:
- 安装
device-mapper-multipathrpm。 - 编辑
multipath.conf配置文件:- 注释出默认黑名单
- 根据需要修改现有默认设置
- 保存配置文件
- 启动多路径守护进程。
- 使用
multipath命令生成多路径设备。
Detailed setup instructions for several example multipath configurations are provided in see 第 3 章 安装 DM-Multipath.
第 2 章 多路径设备 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
没有 DM-Multipath,从服务器节点到存储控制器的所有路径都将被系统视为独立的设备,即便连接相同服务器节点到相同存储控制器的 I/O 路径也不例外。DM-Multipath 提供了逻辑管理 I/O 路径的方法,即在基础设备的顶部生成单一多路径设备。
每个多路径设备都有一个全球识别号(WWID),它是一个全球唯一的无法更改的号码。默认情况下,多路径设备的名称将设为它的 WWID。另外,您还可以在多路径配置文件中设置
user_friendly_names 选项,该选项可将别名设为格式为 mpathn 的节点唯一名称。
例如:当在有两个端口的存储控制器中通过单一不分区 FC 切换附加带两个 HBA 的节点时,可看到四个设备:
/dev/sda、/dev/sdb、dev/sdc 和 /dev/sdd。DM-多路径生成一个有唯一 WWID 的单一设备,该设备可将 I/O 根据多路径配置重新路由到那四个基础设备。当将 user_friendly_names 配置设定为 yes,会将该多路径设备的名称设定为 mpathn。
当在 DM-多路径中添加新设备时,这些新设备会位于
/dev 目录的三个不同位置:/dev/mapper/mpathn、/dev/mpath/mpathn 和 /dev/dm-n。
/dev/mapper中的设备是在引导过程中生成的。可使用这些设备访问多路径设备,例如在生成逻辑卷时。- 提供
/dev/mpath中的设备是为了方便,这样可在一个目录中看到所有多路径设备。这些设备是由udev设备管理器生成的,且在系统需要访问它们时不一定能启动。请不要使用这些设备生成逻辑卷或者文件系统。 - 所有
/dev/dm-n格式的设备都只能是作为内部使用,且应该永远不要使用。
For information on the multipath configuration defaults, including the
user_friendly_names configuration option, see 第 4.3 节 “配置文件默认设置”.
You can also set the name of a multipath device to a name of your choosing by using the
alias option in the multipaths section of the multipath configuration file. For information on the multipaths section of the multipath configuration file, see see 第 4.4 节 “多路径设备配置属性”.
当将
user_friendly_names 配置选项设为 yes 时,该多路径设备的名称对于节点来说是唯一的,但不保证对使用多路径设备的所有节点都一致。如果您使用 LVM 生成逻辑设备,这将不会给您造成任何困难。但如果您需要将您的多路径设备名称在群集中的每个节点上都保持一致,请执行以下步骤之一:
- Use the
aliasoption in themultipathssection of the multipath configuration file to set the name of the multipath device. Thealiasfor the multipath device is consistent across all the nodes in a cluster. For information on themultipathssection of the multipath configuration file, see see 第 4.4 节 “多路径设备配置属性”. - 如果您想要系统定义的用户友好名称在群集中的所有节点间保持一致,请在一台机器中设置所有多路径设备。然后将那台机器中的
/var/lib/multipath/bindings文件复制到群集中其它所有机器中。
In addition to the
user_friendly_names and alias options, a multipath device has numerous attributes. You can modify these attributes for a specific multipath device by creating an entry for that device in the multipaths section of the multipath configuration file. For information on the multipaths section of the multipath configuration file, see see 第 4.4 节 “多路径设备配置属性”.
生成多路径设备后,多路径设备的名称可以与您生成一个 LVM 物理卷时使用的物理设备名称相同。例如:如果多路径名称为
/dev/mapper/mpath0,以下命令可将 /dev/mapper/mpath0 标记为一个物理卷。
pvcreate /dev/mapper/mpath0
pvcreate /dev/mapper/mpath0
您可以如在使用其它 LVM 物理设备一样在创建 LVM 卷组时使用得到的 LVM 物理卷。
当您创建一个使用主动/被动多路径阵列的 LVM 逻辑卷作为基础物理设备时,您应该在
lvm.conf 中添加过滤器以便排除位于多路径设备下的磁盘。这是因为如果阵列在接收 I/O 时自动将主动路径改为被动路径,不过滤掉这些设备,无论何时 LVM 扫描被动路径时多路径将执行出错冗余并进行出错切换。对于需要使用命令激活被动路径的主动/被动阵列,LVM 会在发生这种情况时给出警告信息。
要过滤多路径配置文件(
lvm.conf)中的所有 SCSI 设备,请在该文件的 devices 部分添加以下过滤器。
filter = [ "r/disk/", "r/sd.*/", "a/.*/" ]
filter = [ "r/disk/", "r/sd.*/", "a/.*/" ]
第 3 章 安装 DM-Multipath 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
本章提供了配置 DM-Multipath 的分步示例,其中包括以下步骤:
- 基本 DM-Multipath 安装
- 忽略本地磁盘
- 在配置文件中添加更多设备
3.1. 安装 DM-Multipath 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
在您的系统中安装 DM-Multipath 前,请确定您的系统已经进行了升级,其中包括对
device-mapper-multipath 软件包的升级。
使用以下步骤为基本出错冗余配置安装 DM-Multipath。
- 通过注释出
/etc/multipath.conf文件的开始几行来编辑该文件。配置文件的这一部分在开始的时候是将所有设备都列入黑名单的。您必须将其注释出来以便启用多路径。blacklist { devnode "*" }blacklist { devnode "*" }Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注释出这些行以后,这部分的形式如下。blacklist { devnode "*" }# blacklist { # devnode "*" # }Copy to Clipboard Copied! Toggle word wrap Toggle overflow - DM-Multipath 的默认设置已经被编译到系统中,且无需在
/etc/multipath.conf文件中特别指出。The default value ofpath_grouping_policyis set tofailover, so in this example you do not need to change the default value. For information on changing the values in the configuration file to something other than the defaults, see 第 4 章 DM-Multipath 配置文件.在您系统配置文件的初始默认部分,多路径设备名称的格式为mpathn;如果没有这个设置,多路径设备的名称将会是该设备 WWID 别名。 - 保存配置文件并退出编辑器。
- 执行以下命令:
modprobe dm-multipath service multipathd start multipath -v2
modprobe dm-multipath service multipathd start multipath -v2Copy to Clipboard Copied! Toggle word wrap Toggle overflow multipath -v2命令输出多路径设备的路径来显示哪些设备是多路径设备。如果没有输出任何结果,请确定正确调试了所有 SAN 连接并使系统多路径。For further information on themultipathcommand output, see 第 5.4 节 “Multipath Command Output”. - 执行以下命令以确定在引导时启动了多路径守护进程:
chkconfig multipathd on
chkconfig multipathd onCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Since the value of
user_friendly_name is set to yes in the configuration file the multipath devices will be created as /dev/mapper/mpathn. For information on setting the name of the device to an alias of your choosing, see 第 4 章 DM-Multipath 配置文件.
有些机器在其内部磁盘中有本地 SCSI 卡。不建议在这些设备中使用 DM-Multipath。以下步骤显示如何在配置多路径时修改多路径配置文件来忽略逻辑磁盘。
- 确定哪些磁盘是内部磁盘并将其列入黑名单。在这个示例中,
/dev/sda是内部磁盘。请注意:因为在默认多路径配置文件中已经对其进行了配置,所以执行multipath -v2会在多路径映射中显示本地磁盘/dev/sda。For further information on themultipathcommand output, see 第 5.4 节 “Multipath Command Output”.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 要防止设备映射器在其多路径映射中映射
/dev/sda,请编辑/etc/multipath.conf文件的 blacklist 部分,使其包括该设备。尽管您可以使用devnode类型将sda设备列入黑名单,但那不是一个安全的步骤,因为在重启是无法保证/dev/sda是同一个名称。要将单独的设备列入黑名单,您可以使用那个设备的 WWID 将其列入黑名单。请注意:在multipath -v2命令的输出中,/dev/sda设备的 WWID 是 SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1。要将这个设备列入黑名单,请在/etc/multipath.conf文件中添加以下内容。blacklist { wwid SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1 }blacklist { wwid SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1 }Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 在您更新
/etc/multipath.conf文件后,您必须手动让multipathd守护进程重新载入该文件。以下命令可重新载入更新的/etc/multipath.conf文件。service multipathd reload
service multipathd reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 运行以下命令:
multipath -F multipath -v2
multipath -F multipath -v2Copy to Clipboard Copied! Toggle word wrap Toggle overflow 本地磁盘或者不应再列入新的多路径映射的磁盘如下。Copy to Clipboard Copied! Toggle word wrap Toggle overflow
默认情况下,DM-Multipath 包括对大多数支持 DM-Multipath 的通用存储阵列的支持。默认配置值请参考
multipath.conf.defaults 文件,其中包括支持的设备。
如果您需要添加一个在默认情况下不支持的存储设备作为已知多路径设备,请编辑
/etc/multipath.conf 文件并插入正确的设备信息。
例如:要添加有关 HP Open-V 系列,条目示例如下:
For more information on the
devices section of the configuration file, see 第 4.5 节 “配置文件设备”.
第 4 章 DM-Multipath 配置文件 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
默认情况下,DM-Multipath 为大多数多路径的使用提供配置值。另外,DM-Multipath 包括对支持 DM-Multipath 大多数通用存储阵列的支持。默认配置值和支持的设备请参考
/usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.defaults 文件。
您可以通过编辑
/etc/multipath.conf 配置文件为 DM-Multipath 覆盖默认配置值。如果需要,您还可以在配置文件中添加默认不支持的存储阵列。本章提供了解析和修改 multipath.conf 文件的信息,它包括以下部分:
- 配置文件总览
- 配置文件 blacklist
- 配置文件 defaults
- 配置文件 multipaths
- 配置文件 devices
在多路径配置文件中,您只需要指定需要的配置,或者您想要修改的在
multipath.conf.defaults 文件中指定的默认值。如果文件中有和您的环境不相关的部分或者您不需要覆盖默认值,您可以将其注释出来,因为它们在文件的起始部分。
配置文件允许常规表达式描述语法。
配置文件的注释版本请参考
/usr/share/doc/device-mapper-multipathd-0.4.7/multipath.conf.annotated。
4.1. 配置文件总览 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
多路径配置文件可分为以下几个部分:
- blacklist
- 多路径不会考虑类出具体设备。默认情况下所有设备都会列在黑名单中。通常黑名单部分是被注释出的。
- blacklist_exceptions
- 列出除了根据黑名单部分的参数可能会被列到黑名单中的多路径候选人。
- defaults
- DM-Multipath 的通用默认设置。
- multipaths
- 各个独立多路径设备的特性设置。这些数值覆盖了在配置文件的
defaults和devices部分中指定的数值。 - devices
- 各个存储控制器的设置。这些数值覆盖了在配置文件的
defaults部分指定的数值。如果您要使用不是默认支持的存储阵列,您可能需要为您的阵列创建devices子部分。
当系统决定多路径设备的属性时,首先它会检查多路径设置,然后是每个设备的设置,然后才是多路径系统默认设置。
多路径配置文件的
blacklist 部分指定在系统配置多路径设备时不能使用的设备。黑名单中的设备将无法分组到多路径设备中。
默认情况下,所有设备都列在黑名单中,因为下面这些行出现在配置文件开始的部分。
blacklist {
devnode "*"
}
blacklist {
devnode "*"
}
To enable multipathing on all of the devices that are supported by default, comment out those lines, as described in 第 3.1 节 “安装 DM-Multipath”.
注释出通用黑名单后,您可以在黑名单中指定一般设备类型和个体设备。您可以根据以下标准将设备列入黑名单:
- By WWID, as described in 第 4.2.1 节 “根据 WWID 将设备列入黑名单”
- By device name, as described in 第 4.2.2 节 “根据设备名称将设备列入黑名单”
- By device type, as described in 第 4.2.3 节 “根据设备类型将其加入黑名单”
By default, a variety of device types are blacklisted, even after you comment out the initial blacklist section of the configuration file. For information, see 第 4.2.2 节 “根据设备名称将设备列入黑名单”.
您可根据全球识别号将单独的设备列入黑名单,即在配置文件的
blacklist 部分加入 wwid 条目。
以下示例显示了在配置文件中可将 WWID 为 26353900f02796769 的设备列入黑名单的行。
blacklist {
wwid 26353900f02796769
}
blacklist {
wwid 26353900f02796769
}
您可以根据设备名称将设备类型列入黑名单,以便在配置文件
blacklist 部分的 devnode 条目中指定不要将它们分组到多路径设备中。
以下示例显示了配置文件中可将所有 SCSI 设备列入黑名单的行,因为它的黑名单中有 sd* 设备。
blacklist {
devnode "^sd[a-z]"
}
blacklist {
devnode "^sd[a-z]"
}
您可以使用配置文件
blacklist 部分的 devnode 条目指定要列入黑名单的每个设备,而不是指定特定类型的所有设备,我们不推荐使用后一种情况。除非根据 udev 规则的静态映射,我们无法保证在重启后每个设备的名称是一样的。例如:重启后,某个设备的名称可能从 /dev/sda 变为 /dev/sdb。
By default, the following
devnode entries are compiled in the default blacklist; the devices that these entires blacklist do not generally support DM-Multipath. To enable multipathing on any of these devices, you would need to specify them in the blacklist_exceptions section of the configuration file, as described in 第 4.2.4 节 “黑名单之外的设备”.
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
}
您可在配置文件
blacklist 部分使用 device 部分指定具体设备类型。以下示例将所有 IBM DS4200 设备以及所有 HP 设备都列入了黑名单。
You can use the
blacklist_exceptions section of the configuration file to enable multipathing on devices that have been blacklisted by default. For example, by default, devices with vendor = "IBM" and product = "S/390.*" are blacklisted since usually DASD devices are used for local storage. If you do need to enable multipathing on these devices, uncomment the following lines in the configuration file:
当在配置文件的
blacklist_exceptions 指定设备时,您必须以指定黑名单的相同方法来指定例外情况。例如:在 devnode 黑名单条目中指定的设备无法使用 WWID 将其指定为例外情况,即使列入黑名单的设备和该 WWID 关联也不行。同样,devnode 例外也只适用于 devnode 条目,而 device 例外只适用于 device 条目。
/etc/multipath.conf 配置文件包括 defaults 部分,在该部分中将 user_friendly_names 参数设为 yes,如下。
defaults {
user_friendly_names yes
}
defaults {
user_friendly_names yes
}
这可覆盖
user_friendly_names 参数的默认值。
该配置文件包括配置默认模板。这部分要被注释出来,如下。
要覆盖任意配置参数的默认值,您可将这个模板中相关的行复制到
defaults 部分并取消其注释。例如:要覆盖 path_grouping_policy 参数以便用 multibus 覆盖默认的 failover,请将模板中正确的行复制到配置文件的 defaults 部分并取消对它的注释,如下。
defaults {
user_friendly_names yes
path_grouping_policy multibus
}
defaults {
user_friendly_names yes
path_grouping_policy multibus
}
表 4.1 “多路径配置默认设置” describes the attributes that are set in the
defaults section of the multipath.conf configuration file. These values are used by DM-Multipath unless they are overwritten by the attributes specified in the devices and multipaths sections of the multipath.conf file.
| 属性 | 描述 | |||||||
|---|---|---|---|---|---|---|---|---|
udev_dir | 指定生成 udev 设备节点的目录,默认值为 /udev。 | |||||||
polling_interval | 以秒数指定检查两个路径间的时间间隔,默认值为 5。 | |||||||
selector | 指定用来确定下一个 I/O 操作所使用的路径的默认算法,默认值为 round-robin 0。 | |||||||
path_grouping_policy |
| |||||||
getuid_callout |
| |||||||
prio_callout | Specifies the the default program and arguments to call out to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitable prio value for example. "none" is a valid value. The default value is no callout, indicating all paths are equal | |||||||
path_checker | 指定用来确定路径状态的默认方法。可能的值有 readsector0、tur、emc_clariion、hp_sw 和 directio。默认值为 readsector0。 | |||||||
rr_min_io | 指定在当前路径组群中切换到下一个路径前指向一个路径的 I/O 请求数目。默认值为 1000。 | |||||||
max_fds | (RHEL 5.2 以及之后的版本)会为 multipathd 进程设定打开文件描述符的最大值。在 RHEL 5.3 中,这个选项允许值 max,它可将打开文件描述符的数目设置为系统可承受的最大值。 | |||||||
rr_weight |
| |||||||
failback |
| |||||||
no_path_retry |
| |||||||
flush_on_last_del | (在 RHEL 5.3 以及之后的版本中)如果将其设定为 yes,multipathd 守护进程将在删除了最后一个到某个设备的路径时禁用查询。默认值为 no。 | |||||||
queue_without_daemon | (在 RHEL 5.3 以及之后的版本中)如果将其设定为 no,multipathd 守护进程将在关闭后禁用对所有设备的查询。默认值为 yes。 | |||||||
user_friendly_names | 如果将其设为 yes,即该系统应该使用文件 bindings 来将一个持久且唯一的别名分配给多路径,格式为 mpathn。bindings 文件的默认位置为 /var/lib/multipath/bindings,但使用 bindings_file 选项可改变此位置。如果将其设为 no,即该系统应该使用 WWID 作为多路径的别名。在这两种情况下,您在这里指定的数值将被您在配置文件 multipaths 部分指定的具体设备别名覆盖。默认值为 no。 | |||||||
bindings_file | (在 RHEL 5.2 以及之后的版本中)bindings 文件的位置与 user_friend_names 选项一同使用。默认值为 /var/lib/multipath/bindings。 | |||||||
mode | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的 mode 是八进制的。默认值由具体进程决定。 | |||||||
uid | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的用户 ID。您必须使用数字用户 ID。默认值由具体进程决定。 | |||||||
gid | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的组群 ID。您必须使用数字组群 ID。默认值由具体进程决定。 |
表 4.2 “多路径属性” shows the attributes that you can set in the
multipaths section of the multipath.conf configuration file for each specific multipath device. These attributes apply only to the one specified multipath. These defaults are used by DM-Multipath and override attributes set in the defaults and devices sections of the multipath.conf file.
| 属性 | 描述 | ||||||
|---|---|---|---|---|---|---|---|
wwid | 指定 multipath 属性采用的多路径设备的 WWID。 | ||||||
alias | 指定 multipath 属性采用的多路径符号名称。 | ||||||
path_grouping_policy |
| ||||||
path_selector | 指定用来确定下一个 I/O 操作所使用路径的默认算法。 | ||||||
failback |
| ||||||
rr_weight |
| ||||||
no_path_retry |
| ||||||
flush_on_last_del | (在 RHEL 5.3 以及之后的版本中)如果将其设定为 yes,multipathd 守护进程将在删除了最后一个到某个设备的路径时禁用查询。默认值为 no。 | ||||||
rr_min_io | 指定在当前路径组群中切换到下一个路径前指向一个路径的 I/O 请求数目。 | ||||||
mode | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的 mode 是八进制的。默认值由具体进程决定。 | ||||||
uid | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的用户 ID。您必须使用数字用户 ID。默认值由具体进程决定。 | ||||||
gid | (在 RHEL 5.3 以及之后的版本中)多路径设备节点使用的组群 ID。您必须使用数字组群 ID。默认值由具体进程决定。 |
以下示例显示在配置文件中为两个特定多路径设备指定的多路径属性。第一个设备的 WWID 为
3600508b4000156d70001200000b0000,符号名称为 yellow。
示例中第二个多路径设备的 WWID 为
1DEC_____321816758474,符号名称为 red。在这个示例中,rr_weight 属性被设为 priorities。
4.5. 配置文件设备 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
表 4.3 “设备属性” shows the attributes that you can set for each individual storage device in the
devices section of the multipath.conf configuration file. These attributes are used by DM-Multipath unless they are overwritten by the attributes specified in the multipaths section of the multipath.conf file for paths that contain the device. These attributes override the attributes set in the defaults section of the multipath.conf file.
默认情况下,在多路径配置中包括很多支持多路径的设备。这些设备支持的值默认列在
multipath.conf.defaults 文件中。您可以不需要修改这些设备,但如果修改了这些值,您可以通过在配置文件中为覆盖那些值的设备添加条目来覆盖默认值。您可以从 multipath.conf.defaults 文件中为设备复制设备配置默认设置并覆盖那些您想要修改的值。
要在配置文件的这个部分添加没有默认自动配置的设备,您需要设定
vendor 和 product 参数。您可在 /sys/block/device_name/device/vendor 和 /sys/block/device_name/device/model 文件中找到这些值,其中 device_name 是要进行多路径操作的设备,示例如下:
[root@cypher-06 ~]# cat /sys/block/sda/device/vendor WINSYS [root@cypher-06 ~]# cat /sys/block/sda/device/model SF2372
[root@cypher-06 ~]# cat /sys/block/sda/device/vendor
WINSYS
[root@cypher-06 ~]# cat /sys/block/sda/device/model
SF2372
The additional parameters to specify depend on your specific device. If the device is active/active, you will usually not need to set additional parameters. You may want to set
path_grouping_policy to multibus. Other parameters you may need to set are no_path_retry and rr_min_io, as described in 表 4.3 “设备属性”.
如果设备是主动/被动模式,但它会自动将路径切换到被动路径,那么您需要将检查器改为一个不需向路径发送 I/O 来测试其是否工作(否则,您的设备将一直进行出错冗余)的功能。这几乎意味着您将
path_checker 设为 tur。这对所有支持 Test Unit Ready 命令的 SCSI 设备都适用。
If the device needs a special command to switch paths, then configuring this device for multipath requires a hardware handler kernel module. The current hardware handlers are
emc and "rdac. If these are not sufficient for your device, you may not be able to configure the device for multipath.
| 属性 | 描述 | ||||||
|---|---|---|---|---|---|---|---|
vendor | 指定 device 采用的存储设备的零售商名称,例如 COMPAQ。 | ||||||
product | 指定 device 属性使用的存储设备产品名,比如 HSV110 (C) COMPAQ。 | ||||||
path_grouping_policy |
| ||||||
getuid_callout | Specifies the default program and arguments to call out to obtain a unique path identifier. An absolute path is required. | ||||||
prio_callout | Specifies the the default program and arguments to call out to obtain a path weight. Weights are summed for each path group to determine the next path group to use in case of failue. "none" is a valid value. | ||||||
path_checker | 指定用来确定路径状态的默认方法。可能的值包括 readsector0 和 tur、emc_clariion、hp_sw 以及 directio。 | ||||||
path_selector | 指定用来确定下一个 I/O 操作所使用路径的默认算法。 | ||||||
features | The extra features of multipath devices. The only existing feature is queue_if_no_path, which is the same as setting no_path_retry to queue. For information on issues that may arise when using this feature, see 第 5.3 节 “Issues with queue_if_no_path feature”. | ||||||
hardware_handler | 指定将在切换路径组群或者处理 I/O 错误时用来执行硬件具体动作的模块。可能的值包括 0、1 emc 和 1 rdac。默认值为 0。 | ||||||
rr_weight |
| ||||||
no_path_retry |
| ||||||
failback |
| ||||||
rr_min_io | 指定在当前路径组群中切换到下一个路径前指向一个路径的 I/O 请求数目。默认值为 1000。 | ||||||
flush_on_last_del | (在 RHEL 5.3 以及之后的版本中)如果将其设定为 yes,multipathd 守护进程将在删除了最后一个到某个设备的路径时禁用查询。默认值为 no。 | ||||||
product_blacklist | 根据产品指定用来将设备列入黑名单的常规表达式。 |
以下示例显示了多路径配置文件的
device 条目。
本章提供了在运行的系统中管理 DM-Multipath 的信息,其中包括以下部分:
- The Multipath Daemon
- Issues with Large Number of LUNs
- Issues with queue_if_no_path feature
- Multipath Command Output
- Multipath Queries with multipath Command
- Multipath Command Options
- 用 dmsetup 命令进行多路径查询
- Troubleshooting with the multipathd Interactive Console
5.1. The Multipath Daemon 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
If you find you have trouble implementing a multipath configuration, you should ensure that the multipath daemon is running, as described in 第 3 章 安装 DM-Multipath. The
multipathd daemon must be running in order to use multipathed devices.
5.2. Issues with Large Number of LUNs 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
当在某个节点中添加大量 LUN 时,使用多路径设备可明显延长
udev 设备过滤器为其生成设备节点所用的时间。如果您遇到过这个问题,您可在 /etc/udev/rules.d/40-multipath.rules 文件中删除以下行解决这个问题:
KERNEL!="dm-[0-9]*", ACTION=="add", PROGRAM=="/bin/bash -c '/sbin/lsmod | /bin/grep ^dm_multipath'", RUN+="/sbin/multipath -v0 %M:%m"
KERNEL!="dm-[0-9]*", ACTION=="add", PROGRAM=="/bin/bash -c '/sbin/lsmod | /bin/grep ^dm_multipath'", RUN+="/sbin/multipath -v0 %M:%m"
这行会在每次向该节点中添加块设备时让
udev 设备管理器运行 multipath。虽然删除了这一行,multipathd 守护进程仍将自动生成多路径设备,在引导过程中仍将为带多路径根文件系统的节点调用 multipath。唯一的改变就是没有运行 multipathd 守护进程不再自动生成多路径设备,对大多数多路径用户来说应该不是个问题。
5.3. Issues with queue_if_no_path feature 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
If
features "1 queue_if_no_path" is specified in the /etc/multipath.conf file, then any process that issues I/O will hang until one or more paths are restored. To avoid this, set the no_path_retry N parameter in the /etc/multipath.conf file (where N is the number of times the system should retry a path). When you do, remove the features "1 queue_if_no_path" option from the /etc/multipath.conf as well.
If you need to use the
features "1 queue_if_no_path" option and you experience the issue noted here, use the dmsetup command to edit the policy at runtime for a particular LUN (that is, for which all the paths are unavailable). For example, if you want to change the policy on the multipath device mpath2 from "queue_if_no_path" to "fail_if_no_path", execute the following command.
dmsetup message mpath2 0 "fail_if_no_path"
dmsetup message mpath2 0 "fail_if_no_path"
请注意:您必须指定
mpathn 别名而不是该路径。
5.4. Multipath Command Output 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
当您生成、修改或者列出多路径设备时,您会获得一个当前设备组成的打印输出,格式如下。
对于每个多路径设备:
action_if_any: alias (wwid_if_different_from_alias) [size][features][hardware_handler]
action_if_any: alias (wwid_if_different_from_alias) [size][features][hardware_handler]
对与每个路径组群:
\_ scheduling_policy [path_group_priority_if_known] [path_group_status_if_known]
\_ scheduling_policy [path_group_priority_if_known] [path_group_status_if_known]
对于每个路径:
\_ host:channel:id:lun devnode major:minor [path_status] [dm_status_if_known]
\_ host:channel:id:lun devnode major:minor [path_status] [dm_status_if_known]
例如,多路径命令的输出可能是如下形式:
如果该路径已经启用并准备好进行 I/O,那么路径的状态就是
ready 或者 active。路径的状态由 multipathd 守护进程根据在 /etc/multipath.conf 文件中定义的通信间隔进行周期性更新。
The dm status is similar to the path status, but from the kernel's point of view. The dm status has two states:
failed, which is analogous to faulty, and active which covers all other path states. Occasionally, the path state and the dm state of a device will temporarily not agree.
注意
当生成或者修改一个多路径设备时,路径组群状态和 dm 状态是未知的。同时,特性也不一定正确。当列出多路径设备时,路径组群优先权是未知的。
5.5. Multipath Queries with multipath Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您可以使用
multipath 命令的 -l 和 -ll 选项来显示现有多路径配置。 -l 选项显示从 sysfs 以及设备映射器中收集的多路径拓补信息。-ll 选项显示 -l 显示的所有信息以及该系统额外可用的其它组件。
当显示多路径配置时,您可以使用
multipath 命令的 -v 选项指定三种详细等级。指定为 -v0 时没有输出。指定为 -v1 则只输出生成或者更新的路径名称。指定 -v2 将输出所有检测到的路径、多路径和设备映射。
以下示例显示了
multipath -l 命令的输出。
5.6. Multipath Command Options 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
表 5.1 “有用的
multipath 命令选项” describes some options of the multipath command that you may find useful.
| 选项 | 描述 |
|---|---|
-l | 显示来自 sysfs 和设备映射器的当前多路径配置。 |
-ll | 显示来自 sysfs 、设备映射器以及系统中的其它可用组件的当前多路径配置。 |
-f device | 删除命名的多路径设备。 |
-F | 删除所有多路径设备。 |
您可以使用
dmsetup 找出哪个设备映射器条目与多路径的设备映射。
以下命令显示所有设备映射器设备及其主、副号码。副号码确定 dm 设备的名称。例如:副号码 3 与多路径的设备
/dev/dm-3 对映。
multipathd -k 命令是一个 multipathd 守护进程的互动界面。执行此命令将进入互动的多路径控制台。执行此命令后,您可以输入 help 来获得可用的命令列表。您可以输入互动命令,或者您还可以输入 CTRL-D 退出。
multipathd 互动控制台可用来在您的系统有问题时进行故障排除。例如:以下命令会在退出控制台前显示多路径配置,其中包括默认配置。
multipathd -k > show config > CTRL-D
# multipathd -k
> > show config
> > CTRL-D
以下命令确定多路径已经识别了所有对
multipath.conf 的修改。
multipathd -k > reconfigure > CTRL-D
# multipathd -k
> > reconfigure
> > CTRL-D
使用以下命令组确定路径检查器工作正常。
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
multipathd -k > show paths > CTRL-D
# multipathd -k
> > show paths
> > CTRL-D
附录 A. 修订记录 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
| 修订历史 | |||
|---|---|---|---|
| 修订 3-6.400 | 2013-10-31 | ||
| |||
| 修订 3-6 | 2012-07-18 | ||
| |||
| 修订 1.0-0 | Thu Jan 29 2009 | ||
|
| |||
索引
符号
- /etc/multipath.conf package,安装 DM-Multipath
A
- active/active configuration
- definition,DM-Multipath 总览
- illustration,DM-Multipath 总览
- active/passive configuration
- definition,DM-Multipath 总览
- illustration,DM-Multipath 总览
- alias parameter ,多路径设备配置属性
- configuration file,多路径设备识别器
B
- bindings_file parameter,配置文件默认设置
- blacklist
- configuration file,配置文件黑名单
- default devices,根据设备名称将设备列入黑名单
- device name,根据设备名称将设备列入黑名单
- device type,根据设备类型将其加入黑名单
- in configuration file,安装 DM-Multipath
- WWID,根据 WWID 将设备列入黑名单
- blacklist_exceptions section
- multipath.conf file,黑名单之外的设备
C
- chkconfig command,安装 DM-Multipath
- configuration file
- alias parameter,多路径设备配置属性
- bindings_file parameter,配置文件默认设置
- blacklist,安装 DM-Multipath,配置文件黑名单
- failback parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- features parameter,配置文件设备
- flush_on_last_del parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- getuid_callout parameter,配置文件默认设置,配置文件设备
- gid parameter,配置文件默认设置,多路径设备配置属性
- hardware_handler parameter,配置文件设备
- max_fds parameter,配置文件默认设置
- mode parameter,配置文件默认设置,多路径设备配置属性
- no_path_retry parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- overview,配置文件总览
- path_checker parameter,配置文件默认设置,配置文件设备
- path_grouping_policy parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- path_selector parameter,多路径设备配置属性,配置文件设备
- polling-interval parameter,配置文件默认设置
- prio_callout parameter,配置文件默认设置,配置文件设备
- product parameter,配置文件设备
- product_blacklist parameter,配置文件设备
- queue_without_daemon parameter,配置文件默认设置
- rr_min_io parameter,配置文件默认设置,多路径设备配置属性
- rr_weight parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- selector parameter,配置文件默认设置
- udev_dir parameter,配置文件默认设置
- uid parameter,配置文件默认设置,多路径设备配置属性
- user_friendly_names parameter,配置文件默认设置
- vendor parameter,配置文件设备
- wwid parameter,多路径设备配置属性
- configuring
- DM-Multipath,安装 DM-Multipath
D
- defaults section
- multipath.conf file,配置文件默认设置
- dev/mapper directory,多路径设备识别器
- dev/mpath directory,多路径设备识别器
- device name,多路径设备识别器
- device-mapper-multipath package,安装 DM-Multipath
- devices
- devices section
- multipath.conf file,配置文件设备
- DM-Multipath
- and LVM,逻辑卷中的多路径设备
- components,DM-Multipath 组件
- configuration file,DM-Multipath 配置文件
- configuring,安装 DM-Multipath
- definition,设备映射器多路径
- device name,多路径设备识别器
- devices,多路径设备
- failover,DM-Multipath 总览
- overview,DM-Multipath 总览
- redundancy,DM-Multipath 总览
- setup,安装 DM-Multipath
- setup, overview,DM-Multipath 安装总览
- dm-multipath kernel module ,DM-Multipath 组件
- dm-n devices,多路径设备识别器
- dmsetup command, determining device mapper entries,使用 dmsetup 命令确定设备映射器条目
F
- failback parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- failover,DM-Multipath 总览
- features parameter,配置文件设备
- feedback,反馈
- flush_on_last_del parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
G
H
- hardware_handler parameter,配置文件设备
K
- kpartx command ,DM-Multipath 组件
L
- local disks, ignoring,在生成多路径设备时忽略逻辑磁盘
- LVM physical volumes
- lvm.conf file ,逻辑卷中的多路径设备
M
- max_fds parameter,配置文件默认设置
- mode parameter,配置文件默认设置,多路径设备配置属性
- modprobe command,安装 DM-Multipath
- multipath command ,DM-Multipath 组件,安装 DM-Multipath
- options,Multipath Command Options
- output,Multipath Command Output
- queries,Multipath Queries with multipath Command
- multipath daemon (multipathd),The Multipath Daemon
- multipath devices,多路径设备
- multipath.conf file,存储阵列支持,DM-Multipath 配置文件
- blacklist_exceptions section,黑名单之外的设备
- defaults section,配置文件默认设置
- devices section,配置文件设备
- multipaths section,多路径设备配置属性
- multipath.conf.annotated file,DM-Multipath 配置文件
- multipath.conf.defaults file,存储阵列支持,DM-Multipath 配置文件
- multipathd
- command,Troubleshooting with the multipathd Interactive Console
- interactive console,Troubleshooting with the multipathd Interactive Console
- multipathd daemon ,DM-Multipath 组件
- multipathd start command,安装 DM-Multipath
- multipaths section
- multipath.conf file,多路径设备配置属性
N
P
- path_checker parameter,配置文件默认设置,配置文件设备
- path_grouping_policy parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
- path_selector parameter,多路径设备配置属性,配置文件设备
- polling_interval parameter,配置文件默认设置
- prio_callout parameter,配置文件默认设置,配置文件设备
- product parameter,配置文件设备
- product_blacklist parameter,配置文件设备
Q
- queue_without_daemon parameter,配置文件默认设置
R
- rr_min_io parameter,配置文件默认设置,多路径设备配置属性
- rr_weight parameter,配置文件默认设置,多路径设备配置属性,配置文件设备
S
- selector parameter,配置文件默认设置
- setup
- DM-Multipath,安装 DM-Multipath
- storage array support,存储阵列支持
- storage arrays
U
- udev_dir parameter,配置文件默认设置
- uid parameter,配置文件默认设置,多路径设备配置属性
- user_friendly_names parameter ,多路径设备识别器,配置文件默认设置
V
- vendor parameter,配置文件设备
W
- World Wide Identifier (WWID),多路径设备识别器
- wwid parameter,多路径设备配置属性
法律通告 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Copyright © 2009 Red Hat, Inc.
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.