Multipath 安装和 Openstack Nova + Cinder 配置

本文详细介绍了在OpenStack环境中配置Multipath的方法,包括安装device-mapper-multipath包,生成并编辑multipath.conf文件,重启multipath服务,以及在nova和cinder配置文件中启用Multipath,确保在多路径存储环境下数据读写的稳定性和高可用性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Multipath 安装

不知道,不了解 multipath 的可以看下这个文档(看到 Overview 就差不多了),介绍的很不错:

https://www.sourceware.org/lvm2/wiki/MultipathUsageGuide

1. 安装 device-mapper-multipath RPM 包

检查安装包是否存在(不同 Linux 环境显示的结果不一样):

[root@controller ~]# rpm -qa | grep device-mapper-multipath
device-mapper-multipath-libs-0.4.9-77.el7.x86_64
device-mapper-multipath-0.4.9-77.el7.x86_64
 
 
  • 1
  • 2
  • 3

如果不存在,安装该 RPM 包:

[root@controller ~]# yum install device-mapper-multipath
 
 
  • 1

2. 手动生成 /etc/multipath.conf 文件,命令如下:

[root@controller ~]# mpathconf --enable
 
 
  • 1

3. 编辑 multipath.conf 文件(非必选)

根据自己的配置需求编辑这个配置文件,最简单的是不改文件。

vim /etc/multipath.conf
defaults {
        user_friendly_names yes
        path_grouping_policy multibus
        find_multipaths yes
        no_path_retry fail
        failback immediate
}
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

4. 重启 multipath 服务

请务必确认服务的状态!

[root@controller ~]# systemctl restart multipathd.service
[root@controller ~]# systemctl status multipathd.service
 
 
  • 1
  • 2

如果服务为 failed,请先排查错误,确认状态正常之后再做后面的配置:
Ps: 很多小伙伴都没有这个习惯,导致很多事情做完之后才发现前面的有问题,然后导致连锁问题。

[root@controller ~]# systemctl status multipathd.service
multipathd.service - Device-Mapper Multipath Device Controller
   Loaded: loaded (/usr/lib/systemd/system/multipathd.service; enabled)
   Active: active (running) since Fri 2016-12-30 13:35:18 CST; 1 weeks 2 days ago
  Process: 551 ExecStart=/sbin/multipathd (code=exited, status=0/SUCCESS)
  Process: 534 ExecStartPre=/sbin/multipath -A (code=exited, status=0/SUCCESS)
  Process: 498 ExecStartPre=/sbin/modprobe dm-multipath (code=exited, status=0/SUCCESS)
 Main PID: 558 (multipathd)
   CGroup: /system.slice/multipathd.service
           └─558 /sbin/multipathd

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

Openstack Nova + Cinder 配置

1. 修改 nova 以及 cinder 配置文件

(1) 修改 nova.conf

Use multipath connection of the iSCSI or FC volume (boolean value)
编辑 nova.conf,libvirt 下配置 iscsi_use_multipath=true

[root@controller ~]# grep multipath  /etc/nova/nova.conf
# Use multipath connection of the iSCSI volume (boolean value)
#iscsi_use_multipath=false
iscsi_use_multipath=true
# Use multipath connection of the iSER volume (boolean value)
#iser_use_multipath=false
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

(2) 修改 cinder.conf

Do we attach/detach volumes in cinder using multipath for volume to image and image to volume transfers? (boolean value)
编辑 cinder.conf,在使用的 backend 中配置 use_multipath_for_image_xfer=true

# Do we attach/detach volumes in cinder using multipath for volume to image and
# image to volume transfers? (boolean value)
#use_multipath_for_image_xfer = false

# If this is set to True, attachment of volumes for image transfer will be
# aborted when multipathd is not running. Otherwise, it will fallback to single
# path. (boolean value)
#enforce_multipath_for_image_xfer = false
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

2. 重启 nova 和 cinder 相关服务

(1) 重启 nova-compute 服务(attach multipath)

systemctl restart openstack-nova-compute.service

(2) 重启 cinder-volume 服务(cinder multipath)

systemctl restart openstack-cinder-volume.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值