Show Table of Contents
第 3 章 设置 DM Multipath
本章提供了配置 DM Multipath 的分步示例,其中包括以下步骤:
- 基本 DM Multipath 设置
- 忽略本地磁盘
- 在配置文件中添加更多设备
- 在
initramfs文件系统中启动 Multipath
3.1. 设置 DM Multipath
安装 DM-Multipath 前,请确定系统已升级,其中包括
device-mapper-multipath 软件包升级。
可使用
mpathconf 程序设置多路径,它可创建多路径配置文件 /etc/multipath.conf。
- 如果
/etc/multipath.conf文件已存在,mpathconf程序将会编辑该文件。 - 如果
/etc/multipath.conf文件不存在,mpathconf程序将使用/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf文件作为起始文件。 - 如果
/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf文件不存在,则mpathconf程序将从头开始创建/etc/multipath.conf文件。
如果不需要编辑
/etc/multipath.conf 文件,则可以运行以下命令为 DM-Multipath 设定基本故障切换配置。这个命令可启用多路径配置文件并启动 multipathd 守护进程。
# mpathconf --enable --with_multipathd y
如果需要在启动
multipathd 守护进程前编辑 /etc/multipath.conf 文件,请执行以下步骤为 DM-Multipath 设置基本故障切换配置。
- 运行带
--enable选项的mpathconf命令:#
mpathconf --enable有关可能需要的mpathconf命令的其它选项,请参考mpathconf手册页,或者运行指定--help选项的mpathconf命令。#
mpathconf --helpusage: /sbin/mpathconf <command> Commands: Enable: --enable Disable: --disable Set user_friendly_names (Default y): --user_friendly_names <y|n> Set find_multipaths (Default y): --find_multipaths <y|n> Load the dm-multipath modules on enable (Default y): --with_module <y|n> start/stop/reload multipathd (Default n): --with_multipathd <y|n> - 必要时请编辑
/etc/multipath.conf文件。会将 DM Multipath 的默认设置编译到系统中,且无需在/etc/multipath.conf文件中明确设定。path_grouping_policy的默认值是设为failover,因此在这个示例中您不需要编辑/etc/multipath.conf文件。有关在配置文件中将默认值改为其它数值的详情请参考 第 4 章 DM Multipath 配置文件。在您系统配置文件的初始默认部分配置您的系统以便多路径设备的名称格式为mpathn。如果没有这个设置,多路径设备的名称将会是该设备 WWID 别名。 - 需要时保存配置文件并退出编辑器。
- 执行以下命令:
#
service multipathd start
因为在配置文件中将
user_friendly_name 值设为 yes,那么生成的多路径设备将为 /dev/mapper/mpathn。有关将设备名称设定为您选择的别名的方法,请参考 第 4 章 DM Multipath 配置文件。
如果不想使用用户友好名称,可以运行以下命令:
# mpathconf --enable --user_friendly_names n注意
如果在启动 multipath 守护进程后发现需要编辑 multipath 配置文件,则必须执行
service multipathd reload 命令方可使更改生效。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.