环境说明* M7 v, a! C; B( K1 H
openpstack-Pike对接cephRBD单集群,配置简单,可参考openstack官网或者ceph官网;
6 X7 D0 k2 z& p8 g1.Openstack官网参考配置:
7 g+ P/ ?: a9 Mhttps://docs.openstack.org/cinder/train/configuration/block-storage/drivers/ceph-rbd-volume-driver.html
: m+ Q/ a$ T9 g8 K% Y' N1 j2.Ceph官网参考配置:
/ W1 Z( a5 k5 p1 S; n' g p1 @https://docs.ceph.com/docs/master/install/install-ceph-deploy/7 q4 B; N4 w6 r, X6 z, x u6 |) b/ N
由于物理环境和业务需求变更,当前配置云计算环境要求一套openstack对接后台两套不同版本的cephRBD存储集群;4 w$ m% u* g j7 R/ F
此处以现有以下正常运行环境展开配置;( T% z5 p) V0 x( q+ E
1)openstack-Pike
, J9 K2 Z) `. Y* H; K; ]7 _2 C2)Ceph Luminous 12.2.5
4 K Q; u: Z& }1 \& r5 s9 G: n3)Ceph Nautilus 14.2.7/ m% P# q: O# z5 o7 \
其中,openstack对接ceph Luminous配置完成,且正常运行。现在此套openstack+ceph环境基础上,新增一套ceph Nautilus存储集群,使openstack能够同时调用两套存储资源。& t5 j J4 n6 e" }" V% ?7 q
配置步骤
0 ~0 X/ Y3 B' ~# K4 [; c1.拷贝配置文件
9 U$ f. |, X0 }4 _#拷贝配置文件、cinder账户key到openstack的cinder节点5 M, ?$ K# D( a: k; \% K z
/etc/ceph/ceph2.conf7 e E( E% w$ B; i( ~
/etc/ceph/ceph.client.cinder2.keyring
& K7 {$ P2 l0 r#此处使用cinder账户,仅拷贝cinder2账户的key即可 2.创建存储池2 d2 C: `$ ?3 r/ G) g0 a6 I- c- _3 @
#OSD添加完成后,创建存储池,指定存储池pg/pgp数,配置其对应功能模式
; l& L4 o* Q4 L+ w1 e7 S# \2 c( Z% rceph osd pool create volumes 512 512
; j0 I0 J, l4 a! \; bceph osd pool create backups 128 1282 l( l$ @4 b5 [4 c- \ a7 }& R! ?
ceph osd pool create vms 512 512. R* U: ^1 E/ d5 A+ L3 g
ceph osd pool create images 128 128 ceph osd pool application enable volumes rbd
- Y5 ~1 \, ?( {- L( f! q! U% `7 tceph osd pool application enable backups rbd# s7 ^' ]* h; M1 ?) k6 O/ G
ceph osd pool application enable vms rbd 6 N- n; ?' e8 i6 a5 l+ p9 N
ceph osd pool application enable images rbd 3.创建集群访问账户
$ ^, r9 W) C7 H* Y8 _; Nceph 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‘; Z D; H. j8 W5 F
ceph auth get-or-create client.cinder2-backup mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=backups‘
; V1 ?2 m+ Y) T" q) Uceph auth get-or-create client.glance mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=images‘ 4.查看进程信息
! F( M& f' O3 G: E#查看当前openstack的cinder组件服务进程
# ]' S1 z5 m E! e! X5 G! T/ csource /root/keystonerc.admin6 u& v9 S) g& X @
cinder service-list 5.修改配置文件
& y1 a. s9 z8 Z% B8 d$ B#修改cinder配置文件
$ ]3 @0 p( y# q: }% f[DEFAULT]) Z, G. B( q9 q' ^
enabled_backends = ceph1,ceph2 [ceph1]
( H, s- r' M' T+ S( J: Xvolume_driver = cinder.volume.drivers.rbd.RBDDriver8 n0 P& }, f2 z; E3 l1 L, C
volume_backend_name = ceph1
; V' l- l$ ]. p1 hrbd_pool = volumes1- y" u: g F0 Z7 y7 {8 d
rbd_ceph_conf = /etc/ceph1/ceph1.conf
# L+ F7 | z! c- ?4 f* Qrbd_flatten_volume_from_snapshot = false; s0 @3 Q5 j1 e9 W/ A, R) C
rbd_max_clone_depth = 5$ L5 }: e& M2 e V' _2 S7 ]) Y8 p
rados_connect_timeout = -1) c6 k9 u! U+ O5 b6 h
glance_api_version = 2
3 `$ \0 a" d& P/ ]rbd_user = cinder1$ m1 I+ Z/ t" K* J* e9 T' W4 S" {
rbd_secret_uuid = ** [ceph2]
- Y' K+ n& l6 Y% d, m* [) l7 bvolume_driver = cinder.volume.drivers.rbd.RBDDriver! L; S+ V7 D. M8 N
volume_backend_name = ceph2
1 [1 W% y6 c H5 p, `: ~rbd_pool = volumes2: }, \( W: ]# q6 A) b
rbd_ceph_conf = /etc/ceph/ceph2/ceph2.conf
; J1 m5 y/ g# l( orbd_flatten_volume_from_snapshot = false
( Y2 w9 ~. V/ A0 yrbd_max_clone_depth = 5# @+ z( P# _4 r! w% }2 L- u: ?
rados_connect_timeout = -10 e- `6 ^$ R) F- E, _
glance_api_version = 2& T, s9 S. }5 h
rbd_user = cinder24 G* U) K# L1 `- ]7 y! n
rbd_secret_uuid = ** 6.重启服务
2 v6 v" |) {2 q/ P7 N2 n#重启cinder-volume服务1 R0 d5 \3 U) P1 m
service openstack-cinder-volume restart Redirecting to /bin/systemctl restart openstack-cinder-volume.service
1 n) R9 ^: U( n1 S* k( v2 Dservice openstack-cinder-scheduler restart Redirecting to /bin/systemctl restart openstack-cinder-scheduler.service 7.查看进程
! {- T& o- q+ q6 H- S8 Fcinder service-list 8.创建卷测试3 ]4 q6 l- h2 W$ Y5 V
#卷类型绑定
0 t: j0 |* ^+ [; W8 i: |1 l ycinder type-create ceph16 U! \; n/ p* t% q ?
cinder type-key ceph1 set volume_backend_name=ceph16 P# N0 l |" [; @9 A$ J5 p
cinder type-create ceph2
" V. K' h U! q) ]5 ^/ Ocinder type-key ceph2 set volume_backend_name=ceph2 9.查看绑定结果, {+ I5 f4 u9 i ^% Q
cinder create --volume-type ceph1 --display_name {volume-name}{volume-size}
9 p$ C, t, s! B/ W% t& j8 hcinder create --volume-type ceph2 --display_name {volume-name}{volume-size} 配置libvirt
5 K) b8 e& M, }$ p$ F7 A; G, C! D1.将第二套ceph的密钥添加到nova-compute节点的libvirt& B2 r; I/ W& Q- L( P) \" e
#为了使VM可以访问到第二套cephRBD云盘,需要在nova-compute节点上将第二套ceph的cinder用户的密钥添加到libvirt+ I/ L; }' G' i, c1 i5 T
ceph -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. g& A2 P. x7 r$ d
cat > secret2.xml <<EOF8 [. z* y# ^; s9 X% f
<secret ephemeral=‘no‘ private=‘no‘>$ P4 q$ k) u2 T$ S, t
<uuid>***</uuid>1 ?$ |- B) E/ `5 N
<usage type=‘ceph‘>8 c% `7 j) H6 J& d- I$ G3 a4 g1 O
<name>client.cinder2 secret</name>
, r) _+ X: ^( Q</usage>
% d5 I# s1 l) o7 X' F2 w</secret>
3 y$ I* r4 B9 l3 R2 f3 ]7 t#以上整段拷贝执行即可,替换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' C" o( ?' d( K; L b
#删除提示信息,输入Y即可 2.验证配置是否生效- v8 W f+ Y3 [* E) N0 ~# L" m
#通过之前创建的两个类型的云盘挂载到openstack的VM验证配置
2 ~- _" H) K( w- L1 E" n. T3 S7 |/ \nova volume-attach {instance-id}{volume1-id}7 Z1 @- r. ]4 K" S
nova volume-attach {instance-id}{volume2-id} 参考资料:# _9 i" j. M- z6 O; g: ^
《ceph设计原理与实现》---谢型果
- j- n' N0 H$ N; M红帽官网
' K: F9 u2 z4 k" _https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/3/html/ceph_block_device_to_openstack_guide/installing_and_configuring_ceph_clients5 K ?0 y% ]$ l
ceph官网
v, k7 M$ P4 m% b! whttps://docs.ceph.com/docs/master/install/install-ceph-deploy/ ; R0 E$ r# G2 f N
|