您的位置:首页 > 运维架构

Multipath 安装和 Openstack Nova + Cinder 配置

2017-01-09 12:47 363 查看
该文基于 Centos 7 操作系统。

[root@controller ~]# cat /etc/system-release
CentOS Linux release 7.1.1503 (Core)


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


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

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


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

[root@controller ~]# mpathconf --enable


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
}


4. 重启 multipath 服务

请务必确认服务的状态!

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


如果服务为 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.


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


(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


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


Multipath 安装
安装 device-mapper-multipath RPM 包

手动生成 etcmultipathconf 文件命令如下

编辑 multipathconf 文件非必选

重启 multipath 服务

Openstack Nova Cinder 配置
修改 nova 以及 cinder 配置文件
1 修改 novaconf

2 修改 cinderconf

重启 nova 和 cinder 相关服务
1 重启 nova-compute 服务attach multipath

2 重启 cinder-volume 服务cinder multipath
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息