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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

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

配置步骤$ x1 \% J% [0 F" Y
1.拷贝配置文件( s1 j8 z3 l/ c) F
#拷贝配置文件、cinder账户key到openstack的cinder节点
* H4 a( v  @& ?- c+ ]: f8 I/etc/ceph/ceph2.conf5 ~3 `* i% b# o( A9 X3 `3 u& R
/etc/ceph/ceph.client.cinder2.keyring+ L; ^+ s( s( J$ I) X
#此处使用cinder账户,仅拷贝cinder2账户的key即可

2.创建存储池' v' T0 t: A, j( E/ J% ^
#OSD添加完成后,创建存储池,指定存储池pg/pgp数,配置其对应功能模式
# e! d% D2 W  i/ Tceph osd pool create volumes 512 512  Y4 n% w' {! f( k% z
ceph osd pool create backups 128 128- Q" u% p8 A# X0 B4 E9 W. n& v! }
ceph osd pool create vms 512 512
% V0 a* O/ v0 i. V; Rceph osd pool create images 128 128

ceph osd pool application enable volumes rbd
; O7 W$ ?/ \- |$ P- f. fceph osd pool application enable backups rbd: j% G% [( O% j" O" L" z8 _
ceph osd pool application enable vms rbd
' P# e! V  R0 Z5 d* ^ceph osd pool application enable images rbd

3.创建集群访问账户& g4 N' t, {' g) a$ q" D
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'1 ]( F* o- G( f
ceph auth get-or-create client.cinder2-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'4 d. y7 ]6 F* E" T
ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

4.查看进程信息
( O  r0 ]% W- K& c#查看当前openstack的cinder组件服务进程- v" v! g# _! z+ b" M7 r
source /root/keystonerc.admin' C" |1 Q& ]6 |) y
cinder service-list

5.修改配置文件" [* r# b$ m# h/ N6 `
#修改cinder配置文件/ s4 V/ ~! T, V, Y9 x
[DEFAULT]# L2 J! ~" u- N' @& l
enabled_backends = ceph1,ceph2

[ceph1]" H5 h1 s5 [5 V) }
volume_driver = cinder.volume.drivers.rbd.RBDDriver
" B, s: u/ c; u2 y6 n: ~) m& Tvolume_backend_name = ceph1* y5 S6 ]4 z) e: ^
rbd_pool = volumes1
9 w1 }! W) G5 Lrbd_ceph_conf = /etc/ceph1/ceph1.conf
" r) h/ Q, F5 e9 ~" \' krbd_flatten_volume_from_snapshot = false: j' v' x% u  [; d8 |- }; F
rbd_max_clone_depth = 5( m, x3 t* W9 K( h1 w9 d
rados_connect_timeout = -1" }2 `  b1 `. n) s/ I
glance_api_version = 2
2 K: R) R+ \$ t/ ?. w; \& Drbd_user = cinder1! ]. J+ J$ f. z# {/ V4 b7 a, z
rbd_secret_uuid = **

[ceph2]4 q+ ]/ i6 U2 A! B, Y0 R: N! h
volume_driver = cinder.volume.drivers.rbd.RBDDriver$ H( J( M- X5 t& N$ H: b0 M: ^
volume_backend_name = ceph29 Z( m8 i0 o+ @( S* e5 W! \
rbd_pool = volumes2
, C7 v* J/ X- z. N% l% U; Z. Orbd_ceph_conf = /etc/ceph/ceph2/ceph2.conf) j/ a* Z5 C6 X4 B
rbd_flatten_volume_from_snapshot = false# j/ e% t! E5 }% F2 T8 O  b1 j
rbd_max_clone_depth = 59 }! h  r! o  [6 P6 a
rados_connect_timeout = -1+ I. K! L, c0 }+ c. ~  s2 Z
glance_api_version = 2
( x) i+ w# g1 A  }7 K# b' vrbd_user = cinder2
+ L& k1 t# Q! C' T6 hrbd_secret_uuid = **

6.重启服务* L. `% e" C2 N3 v
#重启cinder-volume服务
7 {, M4 M# G/ V( f* N/ sservice openstack-cinder-volume restart Redirecting to /bin/systemctl restart openstack-cinder-volume.service
' Z2 r( ]5 t0 ?0 f9 R2 y( Lservice openstack-cinder-scheduler restart Redirecting to /bin/systemctl restart openstack-cinder-scheduler.service

7.查看进程
1 _+ b, D3 K; m  T3 L( m* K% H( Ucinder service-list

8.创建卷测试
# J' J, }7 D  @- T6 N#卷类型绑定# `( @0 q* L4 w  I
cinder type-create ceph1
& W% Q3 C5 d) ccinder type-key ceph1 set volume_backend_name=ceph1* Z$ w$ y; F9 c" `' [6 R
cinder type-create ceph2; X  c$ k0 P6 ]: S' ?& `. ]
cinder type-key ceph2 set volume_backend_name=ceph2

9.查看绑定结果7 @( d3 R3 |) P2 t7 n/ |% z8 q
cinder create --volume-type ceph1 --display_name {volume-name}{volume-size}, H  ~( X6 t1 p6 F
cinder create --volume-type ceph2 --display_name {volume-name}{volume-size}

配置libvirt
% Q4 n5 W: L2 W; X5 i1.将第二套ceph的密钥添加到nova-compute节点的libvirt9 X9 h: p6 u- H
#为了使VM可以访问到第二套cephRBD云盘,需要在nova-compute节点上将第二套ceph的cinder用户的密钥添加到libvirt
% w# U! _. g# {7 [% ^* P) Oceph -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集群的uuid4 B8 l) X- m/ H& P! V7 \5 v' h% p# i
cat > secret2.xml <<eof
% ~4 i# t, `8 p# M
1 d% [" G9 b  a! M3 i7 u% Q  n***
2 ?7 F3 }# `2 S* r  {  E( h& k
: q& a9 V1 [5 t% c. W; ^, K$ J8 k; e8 \client.cinder2 secret
( V: k  S" j) G1 G; [7 |) t- ^, X, f) h/ t; o
8 [" D* X6 y! X' `4 h! d
#以上整段拷贝执行即可,替换uuid值</eof4 |; P+ A- r* v

sudo virsh secret-define --file secret2.xml

sudo virsh secret-set-value --secret ***** --base64 $(cat client.cinder2.key) rm client.cinder2.key secret2.xml
  ?9 H7 ^2 v. V1 T2 W#删除提示信息,输入Y即可

2.验证配置是否生效( S4 n# I; I) w& Y4 d$ t4 o
#通过之前创建的两个类型的云盘挂载到openstack的VM验证配置
; T7 z, o: ]1 r) F# p) vnova volume-attach {instance-id}{volume1-id}) {& M1 y3 u0 X5 A# X
nova volume-attach {instance-id}{volume2-id}

* D- _" |( K4 P  v; u
9 }6 w7 U- M! k. P) B! y

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

( z6 }% w8 }& w
配置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
  J/ J- l: ]' 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

$ B; ~; p* G4 q4 y
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/

! v! U' {. K2 a7 K+ _% k; L4 ^
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'

$ R  z- k) `+ y+ F3 n1 g, e, B& \: h
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/
& k2 o; @9 e2 {
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都有可能接收到;此时应该指定默认的类型来接收;

% ~$ C. S0 B; B: T" t[url=][/url]
1 A/ _* W* t( u7 E9 R1 故障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]
# Z% p" {# I8 l, K+ y- B+ j

  {4 g6 D$ n% C9 b& R5 |* z+ C1 k+ k1 `. g6 }( z+ \
cinder配置多ceph后端:并指定默认pool3 @+ g& z8 k# H) |9 V
创建type: cinder type-create  XXX8 X. r) g/ K3 |1 H5 T1 H6 e
cinder type-list
7 d( F9 M7 [2 P9 j+-------------------------------------------------------+--------+
) G$ I0 C- G/ c|                  ID                                 |  Name  |
; Q0 K+ O" P. q( y, P7 U$ |; ^+-------------------------------------------------------+--------+
7 M% l/ C7 d8 H8 x6 f! M) Y! H/ Q| 1908f00c-a865-472c-8f90-c44d29361bd3   | sata03 |
% L( c2 l, H* h, q| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde  |  sata    |9 A/ p: `& y8 q* P( l
| ead23626-0bb9-4515-9906-0b5e6f41320a | sata02 |3 ^. @& ?& ?, }- y% U& z
+-------------------------------------------------------+--------+) C& x$ ^) }  }
0 {" C; e; r0 h4 I
指定extra-specs:cinder type-key XXX set volume_backend_name=CEPH_XXX5 g2 E3 H  n5 l% U: H; E6 B# @
cinder extra-specs-list; S; a4 x$ x( i# p2 t0 B- |
+------------------------------------------------------------+--------+------------------------------------------------------------+
  o9 X1 ~' c2 \" V|                  ID                                                |  Name  |               extra_specs                                        |
# T; {8 Y1 X; D; t/ W0 q+------------------------------------------------------------+--------+------------------------------------------------------------++ g& \% ?/ u8 `& {- ^8 e
| 1908f00c-a865-472c-8f90-c44d29361bd3          | sata03 | {u'volume_backend_name': u'CEPH03_SATA'} |! |4 {# Y' _3 T0 y' }- C
| 3b6e978f-839b-4164-b5e5-8e6e2d63fdde         |  sata    |  {u'volume_backend_name': u'RBD_SATA'}      |
7 Y0 s' ^! \( K( V4 ]1 B| ead23626-0bb9-4515-9906-0b5e6f41320a        | sata02 | {u'volume_backend_name': u'CEPH02_SATA'} |
( }+ Q: B+ ^! d) e8 l3 s+------------------------------------------------------------+--------+------------------------------------------------------------+: R  s- l" {0 Z# e  I
9 ]3 {0 q) o( S/ q2 G' [
修改cinder.conf:3 x, t" ^% q) z# X+ P; S
在DEFAULT段下指定default_volume_type = XXX: O6 p) w1 G: ^
$ `5 Z* [. a+ T& f- @
[DEFAULT]
* h+ M8 P0 K0 P...
# F8 ?1 n9 R" o$ P! odefault_volume_type=XXX  #glance创建的磁盘将位于此处: Z. X' ~8 F4 @- o
enabled_backends=sata02, XXX
2 {4 T( l2 ]) P5 ~) W( n' _/ E" Z
4 W% E: o, g# d% E[XXX]6 U( B& ]# y& J
volume_driver=cinder.volume.drivers.rbd.RBDDriver9 u$ I0 Q: D' S6 w
volume_backend_name=CEPH_XXX% B0 f5 x9 Z9 d3 c" ?6 J" j
rbd_pool=volumes& v. I+ D5 E/ C2 }
rbd_ceph_conf=/etc/ceph/ceph02/ceph.conf9 q& d9 u3 V; G
rbd_user=cinder
' y+ z4 s2 M; Erbd_secret_uuid=62b1ed02-5de2-4a53-be1e-0477d1b385ae
, Q, U$ h5 ^" G  `0 p+ orbd_max_clone_depth=10
+ F0 X- _- m  V/ f3 [* |  s/ trbd_flatten_volume_from_snapshot = false
7 z" E! m5 ^4 T; arbd_store_chunk_size=4
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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