易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 3861|回复: 0
收起左侧

Cinder配置多Ceph后端步骤

[复制链接]
发表于 2018-12-2 17:56:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
1. 检查cinder当前backend配置
使用cinder service-list,查看cinder-volume服务的Host字段格式。
旧版格式:
1 E! v/ {$ f0 ?1 q- l, T
新版格式:

  Q9 [1 Q& c8 [) d" a' D- u  I
旧版中Host字段是cinder-volume服务所在节点的HOSTNAME,新版中Host字段是HOSTNAME@BACKEND。
如果是旧版,需要先修改为新版,见步骤2。
如果是新版,不需要修改,直接执行步骤3。

. y( Y1 t- j& K% x. E2 W- ?
2. 修改旧版backend配置为新版
编辑/etc/cinder/cinder.conf文件,删除其中原有的ceph backend相关配置:
[backcolor=rgb(245, 245, 245) !important][url=]
9 V8 Y+ @3 G. N& P6 k! B, h+ J) {1 v
                               
登录/注册后可看大图
[/url]

% V1 A7 _; h7 T5 d: r2 ?2 b3 i[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=]
4 @, Q8 P$ O2 |& w$ s1 {/ }
                               
登录/注册后可看大图
[/url]
# h. Q3 e, T. |0 l+ ~2 H

3 H3 Y/ Z! n* q) B( ]; e3 _$ X6 k' J: o
添加如下配置:
[backcolor=rgb(245, 245, 245) !important][url=]
1 S4 v3 x6 z* K- g0 |0 o. T
                               
登录/注册后可看大图
[/url]
% \; `7 f& h, ~5 r$ {6 p/ `$ |2 A
[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=]
  P! @& ?8 x" H7 L' ~9 _# M
                               
登录/注册后可看大图
[/url]
& W4 O8 x: T  A" p- G$ b; k2 x+ M
- ^: I5 Z& v% j1 f2 k, C
重启cinder-volume服务:
# service cinder-volume restart                    # 对于Ubuntu 14.04# systemctl restart openstack-cinder-volume        # 对于CentOS 7
6 V+ Y) a; f5 ~% M( t) n5 N( L
执行cinder service-list,查看cinder-volume的Host字段是否变为新版格式。
然后更新已经创建的volume的host属性:
# cinder-manage volume update_host --currenthost HOSTNAME --newhost HOSTNAME@BACKEND
( z& C. ]5 c% a1 X6 e! m; M* |
例如:
# cinder-manage volume update_host --currenthost node-1.domain.tld --newhost node-1.domain.tld @ceph
% E% H- x% }! N- a- V9 d
查看volume 的os-vol-host-attr:host属性已经变为HOSTNAME@BACKEND#RBD的格式:
/ j& |/ V0 k+ \( r+ g$ j$ P
到此,旧版配置格式已经改成新版配置格式,进行步骤3添加另一个ceph后端。
- g! \$ a+ P3 f5 l$ H8 ]
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=]
0 }5 R& d; A  \3 `- H: X# Q
                               
登录/注册后可看大图
[/url]
; g/ _0 E4 x1 R( A4 ~* 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=]

" W2 K6 R6 \3 f# G( J4 v                               
登录/注册后可看大图
[/url]
6 [2 M+ d3 ~0 j) s

  ?) M, L) a8 `2 R" D2 F
重启cinder-volume服务:
# service cinder-volume restart                    # 对于Ubuntu 14.04# systemctl restart openstack-cinder-volume        # 对于CentOS 7
! z0 L% R# \) g4 h$ P1 ^* `: @
执行cinder service-list命令,可以看到每个后端对应一个cinder-volume服务:

9 L; e" v/ V% m) g& Q: M
9 T1 C6 k9 |1 |
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
4 E2 {& U9 Q1 W  C6 v0 u% R
然后执行cinder type-list可以看到配置的volume type:

2 _# L/ k# m5 @% I5 a/ j! ]2 t! @( q: w+ `6 R4 _- i
5. 创建卷
此后创建卷时,可以指定volume type,将卷创建到指定的ceph后端:
# cinder create 10 --name vol-01 --volume-type ceph-sas4 g# Z$ D- f, x. {3 |; U
前端也可选则volume type:
; Q# o) y1 O" M0 V
注:如果不指定volume type,cinder-scheduler会忽略volume type,按默认的调度器从所有cinder-volume调度。
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:21 , Processed in 0.049749 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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