环境说明
" f7 V8 o3 }8 X& T" Oopenpstack-Pike对接cephRBD单集群,配置简单,可参考openstack官网或者ceph官网;
# |4 [0 x2 Y3 C& h5 ~. z* H/ M1.Openstack官网参考配置:
# u( i0 K6 T9 L6 q: ^6 Vhttps://docs.openstack.org/cinder/train/configuration/block-storage/drivers/ceph-rbd-volume-driver.html& t+ |8 b, ~1 P! o' Z' K h4 d
2.Ceph官网参考配置:
8 i7 d8 m" b* H, i, `https://docs.ceph.com/docs/master/install/install-ceph-deploy/5 n/ r, h4 o+ g2 H- u5 q
由于物理环境和业务需求变更,当前配置云计算环境要求一套openstack对接后台两套不同版本的cephRBD存储集群;
5 o }, ]2 K7 i! l( v6 ]% r此处以现有以下正常运行环境展开配置;, ~) x* U4 K. W2 C' b) [* G+ u/ ^
1)openstack-Pike
2 G' ] x; u, y D2)Ceph Luminous 12.2.5
4 N q. ~7 P2 f/ \5 [3)Ceph Nautilus 14.2.7
4 d4 K, O8 I( d/ @2 Y其中,openstack对接ceph Luminous配置完成,且正常运行。现在此套openstack+ceph环境基础上,新增一套ceph Nautilus存储集群,使openstack能够同时调用两套存储资源。
& S4 y% \" Y( o# [7 R( f配置步骤
' I5 d2 G- C0 s2 W2 O9 n1.拷贝配置文件7 n/ p0 ]' G2 B6 |3 c7 @2 g$ b
#拷贝配置文件、cinder账户key到openstack的cinder节点
* C' `1 b! G1 P9 D7 h. _ O* a; I9 x) Y" j% J/etc/ceph/ceph2.conf+ S T2 ^5 L! r( i8 o+ A
/etc/ceph/ceph.client.cinder2.keyring5 _( ~3 k n& t9 ?
#此处使用cinder账户,仅拷贝cinder2账户的key即可 2.创建存储池
( H9 {+ _1 o+ ^; S: M#OSD添加完成后,创建存储池,指定存储池pg/pgp数,配置其对应功能模式5 w [% O$ G# C4 Z+ P
ceph osd pool create volumes 512 512& z1 q, S8 r- T. K0 t
ceph osd pool create backups 128 1288 n& g" ^# L) o9 z1 H4 h- c
ceph osd pool create vms 512 512
. ?$ U$ T" n* `- V) z) {+ z3 aceph osd pool create images 128 128 ceph osd pool application enable volumes rbd& z& g$ q! c" q& U
ceph osd pool application enable backups rbd
" l; L& k, k( L7 s# Mceph osd pool application enable vms rbd 1 C& ~; p- B, K) A9 @& `$ _
ceph osd pool application enable images rbd 3.创建集群访问账户( U- R/ } \; ^& E, \
ceph auth get-or-create client.cinder2 mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images‘2 u A* c& L) h: o4 [/ @
ceph auth get-or-create client.cinder2-backup mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=backups‘
& \- ~' ^; y, q1 F( Fceph auth get-or-create client.glance mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=images‘ 4.查看进程信息
K# C0 O! q4 F" s#查看当前openstack的cinder组件服务进程
) X2 q/ } X' f3 Q' r5 V& v$ Y' W' Isource /root/keystonerc.admin; u1 ~) m2 P+ T3 m5 z2 [- E$ `
cinder service-list 5.修改配置文件/ z/ D4 ~/ O% a8 @$ a" y7 t
#修改cinder配置文件
1 r3 c6 q; n: S4 E4 ][DEFAULT]! M8 k/ O( i6 i
enabled_backends = ceph1,ceph2 [ceph1]
: g0 c! f! A* |# Mvolume_driver = cinder.volume.drivers.rbd.RBDDriver& l* G$ {7 _+ d/ F
volume_backend_name = ceph1
n& x3 U, m7 L+ V5 G4 mrbd_pool = volumes1# i; ]( x! t3 E1 g, Y) a7 m
rbd_ceph_conf = /etc/ceph1/ceph1.conf
0 L4 I* \% t0 e/ b/ Mrbd_flatten_volume_from_snapshot = false% a" |+ `8 X6 b6 A1 r
rbd_max_clone_depth = 5
" s( t# Y8 C# N, u5 qrados_connect_timeout = -1: A( ~+ g6 @7 @ A. n' t
glance_api_version = 21 f" ^. L: K, f: P, I
rbd_user = cinder1% M6 F$ \, ]3 Q" [# g3 U; B; X. J
rbd_secret_uuid = ** [ceph2]" P& t# Q5 ?4 L7 k
volume_driver = cinder.volume.drivers.rbd.RBDDriver) K# K9 E+ A, d! ?+ M* q
volume_backend_name = ceph20 ]. _; e5 z& h/ ~/ F
rbd_pool = volumes2; z1 S( m: H0 A
rbd_ceph_conf = /etc/ceph/ceph2/ceph2.conf
6 X, g* T! f$ I2 Y8 S+ vrbd_flatten_volume_from_snapshot = false5 H2 ]! u, k+ \, c& A
rbd_max_clone_depth = 5
4 _3 T9 J8 k7 A& g& M- yrados_connect_timeout = -1
+ k9 O/ P3 ?; E3 J$ m+ dglance_api_version = 2
7 Y8 D& T) t9 q9 Brbd_user = cinder2
( S* `' i9 n! f. ?0 |rbd_secret_uuid = ** 6.重启服务
# ^. T& ]3 Z& J# U/ G8 B% U: O#重启cinder-volume服务4 G* Q1 j; @/ p v/ `
service openstack-cinder-volume restart Redirecting to /bin/systemctl restart openstack-cinder-volume.service: h5 M* a, M8 H% s8 Q
service openstack-cinder-scheduler restart Redirecting to /bin/systemctl restart openstack-cinder-scheduler.service 7.查看进程! R: Q4 D) W; M' L( }
cinder service-list 8.创建卷测试5 ^0 `; U5 A5 x4 S+ G& I$ N
#卷类型绑定$ g7 g# x: G* X1 |; j# t
cinder type-create ceph1
; c) A+ z6 f9 H& Z l1 a9 Ocinder type-key ceph1 set volume_backend_name=ceph1
9 m0 Z/ T/ z2 E% T* ?3 i, X+ ~cinder type-create ceph2
' h. \: u/ c' e" T9 w* I# qcinder type-key ceph2 set volume_backend_name=ceph2 9.查看绑定结果
% ?' j. Y- I' ^- wcinder create --volume-type ceph1 --display_name {volume-name}{volume-size}
/ l! Q& ?3 }1 K' D. acinder create --volume-type ceph2 --display_name {volume-name}{volume-size} 配置libvirt
& M: E2 k' S+ I2 i1.将第二套ceph的密钥添加到nova-compute节点的libvirt
" H/ _" `; A+ Y2 ?! f7 i' ^: M) D) ^#为了使VM可以访问到第二套cephRBD云盘,需要在nova-compute节点上将第二套ceph的cinder用户的密钥添加到libvirt
7 o. `) K) H M9 v9 lceph -c /etc/ceph2/ceph2/ceph2.conf -k /etc/ceph2/ceph.client.cinder2.keyring auth get-key client.cinder2 |tee client.cinder2.key #绑定之前cinder.conf中第二个ceph集群的uuid
" _+ p4 |, u, ~* S5 Y! s* P8 j& rcat > secret2.xml <<EOF
' e) m! g: h; Q5 a, U8 v! ~1 K<secret ephemeral=‘no‘ private=‘no‘>
8 ~" j1 M- R2 S6 S' F<uuid>***</uuid>
8 V, _6 D$ D7 `' g @<usage type=‘ceph‘>; |+ Z/ v. u+ ?; g% S0 A. R
<name>client.cinder2 secret</name>
7 [/ D2 I; {! h7 }1 _$ z2 ]5 A</usage>8 } ~4 K6 E# k( L8 r) w6 D! [
</secret>
3 J! h3 g5 p: ?5 c#以上整段拷贝执行即可,替换uuid值 sudo virsh secret-define --file secret2.xml sudo virsh secret-set-value --secret ***** --base64 $(cat client.cinder2.key) rm client.cinder2.key secret2.xml
" J+ _3 u ?+ E6 F& x#删除提示信息,输入Y即可 2.验证配置是否生效
& i" K7 {2 [6 m" ^#通过之前创建的两个类型的云盘挂载到openstack的VM验证配置, W# R5 p) r$ |# _ q# x& d3 R
nova volume-attach {instance-id}{volume1-id}
8 `6 m/ b) W# }/ Q t; A- o5 H5 K2 Vnova volume-attach {instance-id}{volume2-id} 参考资料:
: x+ K$ H. I# W& `& `+ J$ j# m6 e《ceph设计原理与实现》---谢型果% ~' ~ p0 x3 E; S% Y k) s
红帽官网" |: ?3 Q0 r- {# [ a; G+ n
https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/3/html/ceph_block_device_to_openstack_guide/installing_and_configuring_ceph_clients( `' {6 G7 t8 M8 ~; {, R
ceph官网
* T6 g) b: h' Mhttps://docs.ceph.com/docs/master/install/install-ceph-deploy/ 4 a$ n* F$ e- W1 N6 v) u% a8 L
|