找回密码
 注册
查看: 4460|回复: 1

扩容ceph添加到原来的openstack节点

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2020-11-25 15:12:12 | 显示全部楼层 |阅读模式

配置步骤
/ T$ {6 W7 _# v& A0 _' B3 w) h; Q1.拷贝配置文件  M5 N8 x8 ]: x8 W  k, E9 p2 ?
#拷贝配置文件、cinder账户key到openstack的cinder节点
) F5 \8 |  p- G9 r$ N1 O% S/etc/ceph/ceph2.conf$ [1 d$ U1 `3 V1 t  B
/etc/ceph/ceph.client.cinder2.keyring
' s; ^  v" K) Q' `#此处使用cinder账户,仅拷贝cinder2账户的key即可

2.创建存储池: N. \# Q; P3 }' q0 \
#OSD添加完成后,创建存储池,指定存储池pg/pgp数,配置其对应功能模式, N; y. Y& P( p
ceph osd pool create volumes 512 512
  ~% v: n! f- T0 X( E. q; J1 [; Wceph osd pool create backups 128 128& |% y  D" S0 E: u; \% _! Q
ceph osd pool create vms 512 5121 ?6 L6 ]* n! l* H7 I( e
ceph osd pool create images 128 128

ceph osd pool application enable volumes rbd
5 O( [3 f. z0 Yceph osd pool application enable backups rbd* b1 r/ r1 \: l2 [8 N
ceph osd pool application enable vms rbd
6 W1 P, V2 _$ N( i; Nceph osd pool application enable images rbd

3.创建集群访问账户# X9 _, D+ X( B) V% Q
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'. z2 w2 u# q' \) e) X! I& N+ U! R
ceph auth get-or-create client.cinder2-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'
8 L: L, V( W0 gceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

4.查看进程信息
" c5 k3 |+ O& g' M#查看当前openstack的cinder组件服务进程
! ^2 o% Z1 {# r. h7 A2 p! s/ tsource /root/keystonerc.admin# L. q2 ?/ u: p
cinder service-list

5.修改配置文件
, \- @  D" I5 p#修改cinder配置文件
. l; w3 Y, m. r# v! R1 X6 v4 M) J[DEFAULT]& `/ j9 z: |  @! Q
enabled_backends = ceph1,ceph2

[ceph1]
4 n# J; L2 B% a8 ~( f: v1 B' `volume_driver = cinder.volume.drivers.rbd.RBDDriver
- K6 u- S' d7 o2 Cvolume_backend_name = ceph1
5 S, y' X* y/ [1 Nrbd_pool = volumes1- c' V2 U4 V* O: r, ]1 A2 {
rbd_ceph_conf = /etc/ceph1/ceph1.conf
( `/ m6 s, p( d0 q& D2 lrbd_flatten_volume_from_snapshot = false
6 M3 Z4 M& V* p2 H! y: j  q4 urbd_max_clone_depth = 5
8 T. k# Z) M& L# Crados_connect_timeout = -1
3 u% G0 x! ~4 `7 y# g- e4 O$ Lglance_api_version = 2
  b- X' |1 N+ c. P* O2 M% Rrbd_user = cinder1- N2 ]/ a( U. S2 h8 \3 f5 y# L
rbd_secret_uuid = **

[ceph2]+ w5 t  [/ J# h0 f6 N( d# I& ~
volume_driver = cinder.volume.drivers.rbd.RBDDriver
* N( a$ `( b0 zvolume_backend_name = ceph2; J. {; J5 t0 `" o& m
rbd_pool = volumes2  \1 v# J: `, }& R
rbd_ceph_conf = /etc/ceph/ceph2/ceph2.conf
% n8 ^& z0 D( yrbd_flatten_volume_from_snapshot = false0 _( N/ H5 q; f6 v5 F5 ^) L: ]
rbd_max_clone_depth = 5& [2 g0 X; k' }1 b6 Y4 W+ V9 T
rados_connect_timeout = -1+ G, R$ ]! q8 {5 \
glance_api_version = 2
% d1 m6 p4 V& {' I) m! brbd_user = cinder2
" v* k# _1 w# b  m, crbd_secret_uuid = **

6.重启服务
& }( B! S( O+ d2 S; e( u#重启cinder-volume服务
% k/ U/ T$ C" ?$ |, {8 \5 Dservice openstack-cinder-volume restart Redirecting to /bin/systemctl restart openstack-cinder-volume.service
9 m  t- Q: O' k& N& p& M$ Eservice openstack-cinder-scheduler restart Redirecting to /bin/systemctl restart openstack-cinder-scheduler.service

7.查看进程2 m7 y) ?! ]$ j" T. u0 |0 T4 F
cinder service-list

8.创建卷测试
3 m! p, I0 g0 s& @% E4 S9 U1 E6 a#卷类型绑定1 _0 Z* z' H6 u! y5 V
cinder type-create ceph1
( a, g/ ]& S7 `cinder type-key ceph1 set volume_backend_name=ceph1
6 n1 G( ?1 n$ \" W% A! R( a4 Scinder type-create ceph2
5 k9 ?+ k$ O% T3 b! @8 A* Jcinder type-key ceph2 set volume_backend_name=ceph2

9.查看绑定结果
& c) b. ?9 K4 J( M: w% M2 \- xcinder create --volume-type ceph1 --display_name {volume-name}{volume-size}4 c6 O$ v8 x. L: _- z7 \+ [
cinder create --volume-type ceph2 --display_name {volume-name}{volume-size}

配置libvirt
4 q  X& b7 g- e; k! q1.将第二套ceph的密钥添加到nova-compute节点的libvirt% j' D8 ^1 p' s7 p" a
#为了使VM可以访问到第二套cephRBD云盘,需要在nova-compute节点上将第二套ceph的cinder用户的密钥添加到libvirt
2 ^9 G  ~' y% d' F! |: G8 x. Fceph -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- p8 Q3 _. e4 n) `' m, i. P, a( D
cat > secret2.xml <<eof6 S. k) j7 q4 s, I$ @! ~

" \, p% p; `9 }9 b7 W3 a! f7 o" l***
8 w6 o0 |! _1 Z* R* ]; f
( M' Z8 v" f! U/ Q+ W" qclient.cinder2 secret
! P. n" N$ S- S9 y; E
2 U9 k$ a% I$ o* A  [
7 B  c! x% [# m/ U, Q( q8 i#以上整段拷贝执行即可,替换uuid值</eof& j7 k; r5 X! C4 f

sudo virsh secret-define --file secret2.xml

sudo virsh secret-set-value --secret ***** --base64 $(cat client.cinder2.key) rm client.cinder2.key secret2.xml6 ~* h( N9 Y2 _: T9 \3 U
#删除提示信息,输入Y即可

2.验证配置是否生效
7 a0 U; m4 c+ y) l! F- j2 h#通过之前创建的两个类型的云盘挂载到openstack的VM验证配置
0 j' r( k3 z. o% Wnova volume-attach {instance-id}{volume1-id}
$ x, D2 B* |4 r9 E" Z6 anova volume-attach {instance-id}{volume2-id}


: P+ X; ^% u/ g! T. H4 ]. g% p# S3 s) a

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2020-11-25 15:49:55 | 显示全部楼层
1、SJ-6-Cloud121  192.168.170.121 操作
创建ceph 磁盘类型
cinder type-create  sata02
cinder type-key sata02  set volume_backend_name=CEPH02_SATA
cinder type-create  sata03
cinder type-key sata03  set volume_backend_name=CEPH03_SATA
! a  O9 r: B# p, ?. h7 v, ~8 J
配置cinder文件
mkdir /etc/ceph/ceph02/
mkdir /etc/ceph/ceph03/
scp 192.168.170.36:/etc/ceph/ceph.conf /etc/ceph/ceph02/
scp 192.168.170.36:/etc/ceph/ceph.client.admin.keyring /etc/ceph/ceph02/
scp 192.168.170.41:/etc/ceph/ceph.conf /etc/ceph/ceph03/
scp 192.168.170.41:/etc/ceph/ceph.client.admin.keyring /etc/ceph/ceph03/
enabled_backends=sata02,sata03
[sata02]
volume_driver=cinder.volume.drivers.rbd.RBDDriver
volume_backend_name=CEPH02_SATA
rbd_pool=volumes
rbd_ceph_conf=/etc/ceph/ceph02/ceph.conf
rbd_user=cinder
rbd_secret_uuid=62b1ed02-5de2-4a53-be1e-0477d1b385ae
rbd_max_clone_depth=10
rbd_flatten_volume_from_snapshot = false
rbd_store_chunk_size=4

5 k; L2 e/ h) V9 o8 i
[sata03]
volume_driver=cinder.volume.drivers.rbd.RBDDriver
volume_backend_name=CEPH03_SATA
rbd_pool=volumes
rbd_ceph_conf=/etc/ceph/ceph03/ceph.conf
rbd_user=cinder
rbd_secret_uuid=62b1ed02-5de2-4a53-be1e-0477d1b385ae
rbd_max_clone_depth=10
rbd_flatten_volume_from_snapshot = false
rbd_store_chunk_size=4
. B9 m. n$ S: B$ K
192.168.170.121 获取cinder glance key
获取默认ceph  cinder glance 认证key
scp /ect/ceph/ceph.client.cinder.keyring 192.168.170.36:/etc/ceph/
scp /ect/ceph/ceph.client.glance.keyring 192.168.170.36:/etc/ceph/
+ i$ Y/ T6 Z+ i8 d0 B% |
ssh 192.168.170.36
导入ceph02 auth key
删除
ceph auth  import -i ceph.client.cinder.keyring
ceph auth  import -i ceph.client.glance.keyring
更新权限ceph
ceph auth caps client.glance  mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=images'

4 _+ k2 X1 ~6 Y  `, X, R
192.168.170.121 获取cinder glance key
获取默认ceph  cinder glance 认证key
scp /ect/ceph/ceph.client.cinder.keyring 192.168.170.41:/etc/ceph/
scp /ect/ceph/ceph.client.glance.keyring 192.168.170.41:/etc/ceph/

; N: a* `3 L! _' ?
ssh 192.168.170.41
导入ceph03 auth key
删除
ceph auth  import -i ceph.client.cinder.keyring
ceph auth  import -i ceph.client.glance.keyring
更新权限ceph
ceph auth caps client.glance  mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=images'
重启cinder服务服务
openstack-service restart openstack-cinder-api
openstack-service restart openstack-cinder-scheduler
openstack-service restart openstack-cinder-volume
配置完此处之后,glance从镜像启动创建磁盘时,rabbitmq消息,多个后端cinder-volume都有可能接收到;此时应该指定默认的类型来接收;

# T* k5 S+ \% }" D[url=][/url]9 q$ U0 B- m; \( c3 R* U# j3 P
1 故障2 3 消息4     Build of instance 9865bdf5-12e5-4147-b1cf-d0e33a5ae88d aborted: Failure prepping block device.5 编码6     5007 详情8     File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2235, in _do_build_and_run_instance filter_properties) File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2349, in _build_and_run_instance 'create.error', fault=e) File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 85, in __exit__ six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2319, in _build_and_run_instance block_device_mapping) as resources: File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__ return self.gen.next() File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2458, in _build_resources reason=msg) [url=][/url]
5 h, K$ [0 a+ E, U! [" V

4 w$ S3 ?% T/ P, s1 \* J
$ k1 C# o$ c* `
cinder配置多ceph后端:并指定默认pool
) n8 N5 F! h% d# }4 [7 d4 r创建type: cinder type-create  XXX
; {6 X6 [/ F$ W7 X7 ~8 M/ Acinder type-list1 h0 e: L! c% f. B+ b! H& A
+-------------------------------------------------------+--------+' N3 V5 m4 g# U# p& q) z( ]
|                  ID                                 |  Name  |9 {6 y$ F- u6 _/ F3 R- E9 A
+-------------------------------------------------------+--------+
4 a' Q; D* b4 ?, e| 1908f00c-a865-472c-8f90-c44d29361bd3   | sata03 |- \, q7 ]. B2 A5 \% u  A
| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde  |  sata    |
$ w+ q( z3 }8 g| ead23626-0bb9-4515-9906-0b5e6f41320a | sata02 |5 _. r- D( R) {( W3 W
+-------------------------------------------------------+--------+
8 ~6 G% K: q; F' y- _/ x) u0 z
) f; H' F0 Y, b4 z8 C指定extra-specs:cinder type-key XXX set volume_backend_name=CEPH_XXX* ^6 k& p1 }+ V2 H; z$ f) O
cinder extra-specs-list. u! `4 |* Z! m0 ]' P/ P, L; N9 H* i
+------------------------------------------------------------+--------+------------------------------------------------------------+5 K, I" k: Z, |* Y! W, l" b
|                  ID                                                |  Name  |               extra_specs                                        |3 Q3 g  P1 g( u5 n) Y
+------------------------------------------------------------+--------+------------------------------------------------------------+( `) q, m/ t; p, p$ c8 Y
| 1908f00c-a865-472c-8f90-c44d29361bd3          | sata03 | {u'volume_backend_name': u'CEPH03_SATA'} |
! P! ~# x9 k# R* e: G| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde         |  sata    |  {u'volume_backend_name': u'RBD_SATA'}      |5 M9 W9 Y5 @  a2 T/ a& h9 m
| ead23626-0bb9-4515-9906-0b5e6f41320a        | sata02 | {u'volume_backend_name': u'CEPH02_SATA'} |6 K* o" Y- k2 h5 q$ _% m0 W; _
+------------------------------------------------------------+--------+------------------------------------------------------------+
. |. f+ P+ [3 r+ c, N% o% d$ Z) ]1 c) e
修改cinder.conf:% s5 m- J+ N* I8 p" R; r3 g+ E
在DEFAULT段下指定default_volume_type = XXX
5 x+ H( B: A% u; r$ i* d* t9 \  h( u/ Z: C! k
[DEFAULT]
8 g" S: R/ P4 ]; e5 W3 R...
5 Q* j6 s" ~. |& N4 idefault_volume_type=XXX  #glance创建的磁盘将位于此处' v' _+ ?' W' g' ]" _2 a
enabled_backends=sata02, XXX+ o' z' o  \0 M5 }

4 ^+ M+ y6 y3 T$ W3 D: r[XXX]1 H6 J5 ?( ]: U* y
volume_driver=cinder.volume.drivers.rbd.RBDDriver  K1 d; d+ A: [0 }
volume_backend_name=CEPH_XXX
* O) B: c) ~- O0 X7 N5 h/ c6 f" _4 Grbd_pool=volumes: K( w. c/ }: }6 d. {' u* R
rbd_ceph_conf=/etc/ceph/ceph02/ceph.conf' K9 w3 ^5 F/ m3 m" d
rbd_user=cinder
% }; R5 A$ F1 L1 _rbd_secret_uuid=62b1ed02-5de2-4a53-be1e-0477d1b385ae
: n5 z( G+ }- B* Lrbd_max_clone_depth=105 Y  _$ u* q% O* ~3 }5 q
rbd_flatten_volume_from_snapshot = false+ v( X! y$ J: b# q! c7 b
rbd_store_chunk_size=4
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 02:04 , Processed in 0.015565 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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