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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

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

配置步骤
9 b- V0 l6 b) i4 E1.拷贝配置文件  ~* s' l' P3 O+ h
#拷贝配置文件、cinder账户key到openstack的cinder节点) j/ N' B5 `9 g6 F7 r
/etc/ceph/ceph2.conf! C" t3 d+ I  ^; v5 N
/etc/ceph/ceph.client.cinder2.keyring
# s( `( k. Y6 p! w! U6 I2 F#此处使用cinder账户,仅拷贝cinder2账户的key即可

2.创建存储池
. @, T5 Y) D  B8 N$ e# Z( z#OSD添加完成后,创建存储池,指定存储池pg/pgp数,配置其对应功能模式! ^, X# R% ?1 ?# L# c9 \: Y5 B, @
ceph osd pool create volumes 512 512
- t2 X3 F9 T. S4 xceph osd pool create backups 128 128. s% P2 W8 T) p  d7 u9 i
ceph osd pool create vms 512 512
* W& Z. I% d5 l, w, S6 C+ Zceph osd pool create images 128 128

ceph osd pool application enable volumes rbd7 W" Q3 i2 {) _; m. L* A: }
ceph osd pool application enable backups rbd0 A$ p; Y( I  d! P
ceph osd pool application enable vms rbd
0 ]# T% b- G5 _) S% Q- c0 Hceph osd pool application enable images rbd

3.创建集群访问账户
. J, Q1 \0 S1 w9 c. O+ q( d6 g+ _' `+ K% Zceph 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'
* f2 H* I$ P) r6 D, Fceph auth get-or-create client.cinder2-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'* a0 L( e0 T2 f- L' l/ v+ W3 J& M, c
ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

4.查看进程信息
$ }! K8 l, c3 P! Y#查看当前openstack的cinder组件服务进程
& \) q* \+ Y" Q* E6 Asource /root/keystonerc.admin
5 B' }' N& _$ z0 ]# \( M; zcinder service-list

5.修改配置文件5 D- o1 P$ V( k# k+ t, L
#修改cinder配置文件/ q! S* T. s. g! {, g
[DEFAULT], G. K0 H- H9 y% J2 p6 G% C
enabled_backends = ceph1,ceph2

[ceph1]
% Z6 W7 e( p+ b1 |; w8 Q$ Zvolume_driver = cinder.volume.drivers.rbd.RBDDriver
0 x' ?9 `( _/ j/ w9 Dvolume_backend_name = ceph11 H6 S: C1 U. W+ ]4 Z
rbd_pool = volumes1
  U; ^( Y" B) j' ]rbd_ceph_conf = /etc/ceph1/ceph1.conf
3 R) j, X! j; Q/ q! e4 `4 _2 _3 crbd_flatten_volume_from_snapshot = false
" k! s) z- Z- H( r, lrbd_max_clone_depth = 5
& n1 l& ~4 |5 B5 f. K' R4 zrados_connect_timeout = -12 k' W7 L3 P; Q2 V: u3 X- |
glance_api_version = 20 V1 n/ G# s8 b2 a
rbd_user = cinder1
# `0 m2 K2 l2 H5 x: A& D) mrbd_secret_uuid = **

[ceph2]* L* B* A0 z, e' r8 w6 [2 y% A9 O
volume_driver = cinder.volume.drivers.rbd.RBDDriver
. D2 J* i4 O$ {: E! N5 Z& x& _volume_backend_name = ceph2
: K. F4 {5 J/ M6 r$ K1 v3 Rrbd_pool = volumes2
5 F/ T5 d, p4 T5 S( |6 R  }) O) }rbd_ceph_conf = /etc/ceph/ceph2/ceph2.conf/ _7 }9 D& p: j- s9 Y8 n
rbd_flatten_volume_from_snapshot = false
" I6 K+ i7 z+ F' L4 Y" s' Nrbd_max_clone_depth = 5  ?& d, u* Z# j. j: l' x( n8 O3 `
rados_connect_timeout = -1
" \7 l- S5 p5 |5 L4 tglance_api_version = 2- ^- G9 V6 C0 A: D) q1 K
rbd_user = cinder2: {: G$ p- P$ F3 v! U
rbd_secret_uuid = **

6.重启服务; T/ P+ y0 _$ ^' |* D0 D; Z  _0 \
#重启cinder-volume服务! V$ h; o; t2 q& {8 r9 r$ ^
service openstack-cinder-volume restart Redirecting to /bin/systemctl restart openstack-cinder-volume.service
: G7 [8 d' R2 w5 O2 o$ }2 zservice openstack-cinder-scheduler restart Redirecting to /bin/systemctl restart openstack-cinder-scheduler.service

7.查看进程. [% n# {; V* f1 B( ?6 K
cinder service-list

8.创建卷测试% T1 M6 A" O  V& M1 i# l6 A- g+ ]1 G
#卷类型绑定# j- X, o3 F& b4 p% E0 r- P+ l- j( W
cinder type-create ceph1, f2 L2 I  u/ s$ N$ z- v  V, p
cinder type-key ceph1 set volume_backend_name=ceph1
1 {( y" \1 a" c) M2 ^8 qcinder type-create ceph2
0 H3 f  w$ M7 wcinder type-key ceph2 set volume_backend_name=ceph2

9.查看绑定结果' l9 s% E3 F8 R+ c& [2 @2 u
cinder create --volume-type ceph1 --display_name {volume-name}{volume-size}- N# q& i  W6 e6 M
cinder create --volume-type ceph2 --display_name {volume-name}{volume-size}

配置libvirt
! a$ N3 \' K# x# C) `0 r9 t! n1.将第二套ceph的密钥添加到nova-compute节点的libvirt
0 W3 f0 w6 q5 L$ F#为了使VM可以访问到第二套cephRBD云盘,需要在nova-compute节点上将第二套ceph的cinder用户的密钥添加到libvirt1 p$ D  I1 n! t' W  O- r8 f
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" o+ @0 D& t  o0 b/ g  R
cat > secret2.xml <<eof9 N+ A1 z' U2 }/ F

' ?+ \5 k: A( w6 u( T5 l***+ R# V$ t. N2 r) n1 b3 D8 w+ `8 i

# h. t& C+ t% z, @: C* t( aclient.cinder2 secret7 W$ M6 B) }# w8 p$ I& y6 c5 N& J9 ~

; F1 C* f, D, E
- {5 }) Q" x5 Z" s$ Y# a% w6 D#以上整段拷贝执行即可,替换uuid值</eof
( I: g8 \- |4 b8 F8 S* _( L% I. P

sudo virsh secret-define --file secret2.xml

sudo virsh secret-set-value --secret ***** --base64 $(cat client.cinder2.key) rm client.cinder2.key secret2.xml
) S, x$ M" u, b7 Y. Q, y9 h! A3 v$ G* Z#删除提示信息,输入Y即可

2.验证配置是否生效
/ [, A1 C# k9 N" N6 a#通过之前创建的两个类型的云盘挂载到openstack的VM验证配置2 t% s4 ]' p3 U/ f: K3 z6 C$ j
nova volume-attach {instance-id}{volume1-id}
; t8 @% j% A6 q# H+ wnova volume-attach {instance-id}{volume2-id}

$ Q- }* r4 a9 w" I. B) Y2 D
' `+ u$ D1 T" m5 ?

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
' B" `2 F+ E. [2 B% L, h) o6 U
配置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

: u+ H" _% Q0 Q% E- o+ y2 ?! R
[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
3 M) p+ z4 [$ T1 K0 u0 z, W
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/

! p  L+ C1 d, A& Y8 V
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'
' g$ F5 J, x- H6 ~
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/
3 {  [( e# @8 O# y9 U
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都有可能接收到;此时应该指定默认的类型来接收;
& D9 x' U: P2 i- \
[url=][/url]& g0 U, l' `7 _0 }' F
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]
9 i0 j9 K2 J5 U+ I: i, n* M3 T

% ]  l9 b  N; \
- k3 d7 m- p# E( [* a! y9 \
cinder配置多ceph后端:并指定默认pool( E# f0 K+ Z. E- M
创建type: cinder type-create  XXX  c+ b! u- m: b) {9 K
cinder type-list
- i6 O4 G; @* ]' I1 u) W) u+-------------------------------------------------------+--------+; ]) L& w0 a1 G/ m& ~+ k$ U7 Y
|                  ID                                 |  Name  |7 \. U0 [2 ~' C
+-------------------------------------------------------+--------+
0 e1 H+ P  ?8 A. J| 1908f00c-a865-472c-8f90-c44d29361bd3   | sata03 |
, g% |1 W/ U) Y3 M5 X4 ?| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde  |  sata    |
, l7 A9 ^4 R- k| ead23626-0bb9-4515-9906-0b5e6f41320a | sata02 |
2 i7 d5 y- ]8 g7 U6 s+-------------------------------------------------------+--------+) k3 @. U& ]( H9 A! ]* r

7 f* Z& |; G1 g  B! q6 L, T指定extra-specs:cinder type-key XXX set volume_backend_name=CEPH_XXX
, a$ ?: V$ c4 _& mcinder extra-specs-list% B3 e# K6 J/ z0 e
+------------------------------------------------------------+--------+------------------------------------------------------------+/ D- J5 {" a5 Y9 N/ v8 P. H! a" Z
|                  ID                                                |  Name  |               extra_specs                                        |  Y" y* C6 J6 [4 H2 Y
+------------------------------------------------------------+--------+------------------------------------------------------------+
+ N5 k! w7 F) Y1 b1 ^) o$ k9 w| 1908f00c-a865-472c-8f90-c44d29361bd3          | sata03 | {u'volume_backend_name': u'CEPH03_SATA'} |( E" i* z$ z7 q. z' h
| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde         |  sata    |  {u'volume_backend_name': u'RBD_SATA'}      |
* \8 E  @' ^3 D+ X* _& s. `# c| ead23626-0bb9-4515-9906-0b5e6f41320a        | sata02 | {u'volume_backend_name': u'CEPH02_SATA'} |( ?; H+ M7 A) s9 ]0 `" ]8 b
+------------------------------------------------------------+--------+------------------------------------------------------------+0 s9 g) h2 l5 ~' E4 ~
! Y& D3 r, v5 c+ G9 n) {2 v
修改cinder.conf:  b$ s+ E4 u* @: |+ E. c
在DEFAULT段下指定default_volume_type = XXX& x) c9 X/ }' w5 `, U. ]! a

' N6 O0 d" X* N[DEFAULT]' x1 b# O5 y  X5 u* K- p1 o; w% i
.... p' k! K( ?) ?/ h* _
default_volume_type=XXX  #glance创建的磁盘将位于此处
+ a& n0 h& o, [5 B2 x' penabled_backends=sata02, XXX
* H" g8 E* j; ]1 x
' N+ y6 z  _) k# q[XXX]
( k5 K) U) k4 [volume_driver=cinder.volume.drivers.rbd.RBDDriver/ M/ Y+ E7 M2 G
volume_backend_name=CEPH_XXX
! a% T) \* x: Z9 B- Yrbd_pool=volumes
# [) g( `7 X' z& R5 W- P5 V6 i; K: _rbd_ceph_conf=/etc/ceph/ceph02/ceph.conf& k) Q7 F& `9 [# R; b# G5 \
rbd_user=cinder* D- F( P& c" T8 H( l: V
rbd_secret_uuid=62b1ed02-5de2-4a53-be1e-0477d1b385ae9 a$ [: G8 p) \0 D
rbd_max_clone_depth=10: g+ p( Z% k5 `8 D3 I4 Y6 ]' L
rbd_flatten_volume_from_snapshot = false
; h, O  X/ @( z% }+ k4 u4 X8 Lrbd_store_chunk_size=4
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 00:00 , Processed in 0.027802 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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