找回密码
 注册
查看: 3865|回复: 0

Cinder配置多Ceph后端步骤

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-2 17:56:36 | 显示全部楼层 |阅读模式
1. 检查cinder当前backend配置
使用cinder service-list,查看cinder-volume服务的Host字段格式。
旧版格式:
% C+ [" |& H& y5 x( W, v! T( |
新版格式:
& \/ q% _3 {4 u6 H
旧版中Host字段是cinder-volume服务所在节点的HOSTNAME,新版中Host字段是HOSTNAME@BACKEND。
如果是旧版,需要先修改为新版,见步骤2。
如果是新版,不需要修改,直接执行步骤3。

& S9 R) c2 `# ], Q4 o7 p
2. 修改旧版backend配置为新版
编辑/etc/cinder/cinder.conf文件,删除其中原有的ceph backend相关配置:
[backcolor=rgb(245, 245, 245) !important][url=][/url]
/ U) D2 [2 @. S[DEFAULTrbd_store_chunk_size = 4rbd_max_clone_depth = 5rbd_flatten_volume_from_snapshot = truerbd_ceph_conf = /etc/ceph/ceph.confrbd_pool = volumesrados_connect_timeout = -1volume_driver = cinder.volume.drivers.rbd.RBDDriver[backcolor=rgb(245, 245, 245) !important][url=][/url]
3 E) C& _5 m9 K" ~. O# T& l# J9 \7 R6 L+ A) G) d
添加如下配置:
[backcolor=rgb(245, 245, 245) !important][url=][/url]2 l  r0 ?4 E+ Y0 s
[DEFAULTenabled_backends = ceph[cephrbd_pool = volumesrbd_ceph_conf = /etc/ceph/ceph.confrbd_flatten_volume_from_snapshot = truerbd_max_clone_depth = 5rbd_store_chunk_size = 4rados_connect_timeout = -1glance_api_version = 2volume_backend_name=cephvolume_driver = cinder.volume.drivers.rbd.RBDDriver[backcolor=rgb(245, 245, 245) !important][url=][/url]( |8 o" V7 A5 B( ^  F6 b! h
* ~; C  U6 M8 o$ x, M
重启cinder-volume服务:
# service cinder-volume restart                    # 对于Ubuntu 14.04# systemctl restart openstack-cinder-volume        # 对于CentOS 7/ `% h! Q: F4 F- M: F/ f5 c; @
执行cinder service-list,查看cinder-volume的Host字段是否变为新版格式。
然后更新已经创建的volume的host属性:
# cinder-manage volume update_host --currenthost HOSTNAME --newhost HOSTNAME@BACKEND9 q: R, I5 l8 G- i& u# D( }
例如:
# cinder-manage volume update_host --currenthost node-1.domain.tld --newhost node-1.domain.tld @ceph8 c6 E, }& z$ q! p7 [' |/ \2 i% K
查看volume 的os-vol-host-attr:host属性已经变为HOSTNAME@BACKEND#RBD的格式:

$ ~* m: X3 k! j/ A! L
到此,旧版配置格式已经改成新版配置格式,进行步骤3添加另一个ceph后端。
- V* U1 Q0 O3 Z: j" g" M9 J( O
3. 添加一个ceph后端
将新的ceph集群的配置文件复制到所有openstack节点(包括控制节点和计算节点)。
注意:不同ceph集群依靠配置文件的名字区分,如:已有ceph集群的配置文件为/etc/ceph/ceph.conf,如果新集群全用SAS盘,配置文件可以命名为:/etc/ceph/ceph-sas.conf。
然后编辑/etc/cinder/cinder.conf,添加新的ceph backend,编辑完后的相关配置如下:
[backcolor=rgb(245, 245, 245) !important][url=][/url]- \5 ?4 I4 ]3 v  U7 M+ o7 B
[DEFAULTenabled_backends = ceph,ceph-sas[cephrbd_pool = volumesrbd_ceph_conf = /etc/ceph/ceph.confrbd_flatten_volume_from_snapshot = truerbd_max_clone_depth = 5rbd_store_chunk_size = 4rados_connect_timeout = -1glance_api_version = 2volume_backend_name=cephvolume_driver = cinder.volume.drivers.rbd.RBDDriver[ceph-sasrbd_pool = volumesrbd_ceph_conf = /etc/ceph/ceph-sas.confrbd_flatten_volume_from_snapshot = truerbd_max_clone_depth = 5rbd_store_chunk_size = 4rados_connect_timeout = -1glance_api_version = 2volume_backend_name=ceph-sasvolume_driver = cinder.volume.drivers.rbd.RBDDriver[backcolor=rgb(245, 245, 245) !important][url=][/url]
) U& s% b, [' t# {- [5 I- o. c) [" B4 O, l# v
重启cinder-volume服务:
# service cinder-volume restart                    # 对于Ubuntu 14.04# systemctl restart openstack-cinder-volume        # 对于CentOS 7
. |$ P  w5 L$ u5 u7 f6 v* D
执行cinder service-list命令,可以看到每个后端对应一个cinder-volume服务:

' [8 g% w3 x) o2 j, W0 M' ~* P+ Y. ~; v9 |1 C3 l1 F
4. 配置volume-type
对于每个ceph后端,创建一个volume type,并将volume type关联配置文件中的volume_backend_name:
# cinder type-create ceph# cinder type-key ceph set volume_backend_name=ceph# cinder type-create ceph-sas# cinder type-key ceph-sas set volume_backend_name=ceph-sas
/ V9 a0 ?+ I$ X. ]
然后执行cinder type-list可以看到配置的volume type:

* L4 S/ A5 C) f6 s. {
0 d$ W  ~; V% M; d
5. 创建卷
此后创建卷时,可以指定volume type,将卷创建到指定的ceph后端:
# cinder create 10 --name vol-01 --volume-type ceph-sas+ Y. }  ?  G% c1 q( X. D! E2 J% Z
前端也可选则volume type:

0 i. N/ T* u& k; O# x& _" _
注:如果不指定volume type,cinder-scheduler会忽略volume type,按默认的调度器从所有cinder-volume调度。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 03:53 , Processed in 0.023823 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表