使用mpathconf 实用程序配置 DM-Multipath

使用 mpathconf 实用程序配置 DM-Multipath。
如果需要,mpathconf 实用程序会使用 /usr/share/doc/device-mapper-multipath-[version] 目录中的示例 multipath.conf 文件的副本作为模板创建或者修改 /etc/multipath.conf 文件。
运行 mpathconf -help 以显示用法:

# mpathconf --help
usage: /sbin/mpathconf [command]
Commands:
Enable: --enable 
Disable: --disable
Only allow certain wwids (instead of enable): --allow [WWID]
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]
select output file (Default /etc/multipath.conf): --outfile [FILE]

默认情况下,mpathconf 实用程序加载 device-mapper-multipath 内核模块并启用 user_friendly_names 和 find_multipaths 属性。

不带任何参数运行 mpathconf 以显示 DM-Multipath 的状态。

# mpathconf 
multipath is enabled
find_multipaths is enabled
user_friendly_names is enabled
dm_multipath module is not loaded
multipathd is not running

对于具有所有默认值的基本故障转移配置,请运行:

# mpathconf --enable

要启用多路径配置并启动 multipathd 服务,请运行:

# mpathconf --enable --with_multipathd y

其他命令是:

  • -user_friendly_names [y|n] - 如果设置为 y,这会将 user_friendly_names yes 行添加到 /etc/multipath.conf 默认部分。如果设置为 n,这将删除该行。
  • -find_multipaths [y|n] - 如果设置为 y,这会将 find_multipaths yes 行添加到 /etc/multipath.conf 默认部分。如果设置为 n,这将删除该行。有关 find_multipaths 的说明,请参阅 multipath.conf(5) 手册页。
  • -with_module [y|n] - 如果设置为 y,则运行 modprobe dm_multipath 以安装多路径模块。这仅适用于 -enable 命令。
  • -with_multipathd [y|n] - 如果设置为 y,则运行 systemctl enable multipathd 以在 -enable 上启动 multipathd,并在 -disable 上运行 systemctl stop multipathd。

在对 /etc/multipath.conf 配置文件进行任何更改后,始终重新加载 multipathd 服务。

# systemctl reload multipathd
日期:2020-09-17 00:14:45 来源:oir作者:oir