找回密码
 注册
查看: 4448|回复: 0

openstack对接ceph存储

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2020-11-27 15:58:44 | 显示全部楼层 |阅读模式
As a storage administrator, you must install and configure Ceph before the Red Hat OpenStack Platform can use the Ceph block devices.
2.1. Prerequisites
& x& }! u$ c) g1 d7 W
9 {+ p5 G) v, M: `3 o
2 \1 O% F1 B0 |4 _5 `# N3 v4 T
  • A new or existing Red Hat Ceph Storage cluster.
    + C( A' v3 B2 ^5 W" o* O
  M( J$ x4 x# L) u1 M2 ~
2.2. Creating Ceph pools for Openstack
. O, T$ L. ]# {0 \( V) w4 k& S% X6 _1 l" _
+ h5 ?$ C5 x8 R8 k- b
Creating Ceph pools for use with OpenStack. By default, Ceph block devices use the rbdpool, but you can use any available pool.
Prerequisites
  • A running Red Hat Ceph Storage cluster.+ M( d6 @1 u2 R! H( k* G. x

6 i5 K' ]1 [& a, n2 [
Procedure
  • Verify the Red Hat Ceph Storage cluster is running, and is in a HEALTH_OK state:
    [root@mon ~]# ceph -s
  • Create the Ceph pools:
    [size=1.12]Example
    $ b. X' z, y" u, Y; D: K0 e
    [root@mon ~]# ceph osd pool create volumes 128[root@mon ~]# ceph osd pool create backups 128
    / E% x# ?0 o9 m( q( C5 I, n
2 q2 \# b5 T/ x0 V% p" S
      [root@mon ~]# ceph osd pool create images 128[root@mon ~]# ceph osd pool create vms 128( @5 {) K; \8 s) l. ]( F
% M0 v  A" |5 b& _2 H% E

1 p1 n( L4 ^3 I; Z0 U" \8 P! i
In the above example, 128 is the number of placement groups.
IMPORTANT
8 w7 Q/ _7 j7 ~, J- G& Z  S4 j# S8 j0 O% z: N* x  K8 {4 `
Red Hat recommends using the Ceph Placement Group’s per Pool Calculator to calculate a suitable number of placement groups for the pools.
) \7 l1 t0 C/ Z
1 p' R# L( z+ I8 c4 y
Additional Resources
  • See the Pools chapter in the Storage Strategies guide for more details on creating pools.
    ' E  ^% ]4 S6 A7 Q) b3 F$ f% a
2 o8 x. W6 J" z4 [3 e. a4 X9 s; e* e9 g
2.3. Installing the Ceph client on Openstack
: G1 K' u# Q; U# ^* Q: N3 V* s/ `( S) G0 Z, x
( s! J+ W) J+ U. h, w! K8 p5 d" q# D
Install the Ceph client packages on the Red Hat OpenStack Platform to access the Ceph storage cluster.
Prerequisites
  • A running Red Hat Ceph Storage cluster.
  • Access to the Ceph software repository.
  • Root-level access to the OpenStack Nova, Cinder, Cinder Backup and Glance nodes.% F: A3 y3 N% b4 G
* J4 m! A7 Z5 M7 h
Procedure
  • On the OpenStack Nova, Cinder, Cinder Backup nodes install the following packages:
    [root@nova ~]# yum install python-rbd, Q2 r  {$ I( ?! F8 J
      [root@nova ~]# yum install ceph-common7 w. I: z+ A6 [) [# O2 }2 x
  • On the OpenStack Glance node install the python-rbd package:
    [root@glance ~]# yum install python-rbd: L, u/ s3 n5 s  m/ M9 [

, Q+ n" T( R( R2 \2.4. Copying the Ceph configuration file to Openstack
* I6 y9 C9 D. R: R4 Q0 a  l
6 M! v4 T7 n* U1 r/ V
! k& B9 }- ]7 D- `
Copying the Ceph configuration file to the nova-compute, cinder-backup, cinder-volume, and glance-api nodes.
Prerequisites
  • A running Red Hat Ceph Storage cluster.
  • Access to the Ceph software repository.
  • Root-level access to the OpenStack Nova, Cinder, and Glance nodes.6 p; C1 ^7 m; A. V# h; o
- \  B1 F  a( j. g6 H. Y
Procedure
  • Copy the Ceph configuration file from the Ceph Monitor node to the OpenStack Nova, Cinder, Cinder Backup and Glance nodes:
    [root@mon ~]# scp /etc/ceph/ceph.conf OPENSTACK_NODES:/etc/ceph3 d3 Y3 F; X1 b5 R+ `  }
- p1 O" M# d$ ]% Z3 |9 W7 D4 {
2.5. Configuring Ceph client authentication
1 f5 u7 j/ J& U- n0 f; a$ o8 s& A8 \: t+ g
' u: i5 N9 N! h- c3 i: l/ Y- R
Configure authentication for the Ceph client to access the Red Hat OpenStack Platform.
Prerequisites
  • Root-level access to the Ceph Monitor node.
  • A running Red Hat Ceph Storage cluster., I6 e; K6 U( B- m3 m
4 i  {. r# a; z2 z
Procedure
  • From a Ceph Monitor node, create new users for Cinder, Cinder Backup and Glance:
    [root@mon ~]# ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images'0 J$ {1 Y. j& W; o3 h

. t( S" ?+ l& f      [root@mon ~]# ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'$ ?* g- \% {7 M7 }! p" q
      [root@mon ~]# ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'
( N/ Q; U1 H; `% e
  • Add the keyrings for client.cinder, client.cinder-backup and client.glance to the appropriate nodes and change their ownership:
    [root@mon ~]# ceph auth get-or-create client.cinder | ssh CINDER_VOLUME_NODE sudo tee /etc/ceph/ceph.client.cinder.keyring: {$ E3 w3 q1 a) ]
      [root@mon ~]# ssh CINDER_VOLUME_NODE chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring/ A/ H( l" c3 q( |8 |
      [root@mon ~]# ceph auth get-or-create client.cinder-backup | ssh CINDER_BACKUP_NODE tee /etc/ceph/ceph.client.cinder-backup.keyring
& c+ V# J' @( T/ S0 D2 F      [root@mon ~]# ssh CINDER_BACKUP_NODE chown cinder:cinder /etc/ceph/ceph.client.cinder-backup.keyring
' a9 r2 ^, ^# N2 E& N; k      [root@mon ~]# ceph auth get-or-create client.glance | ssh GLANCE_API_NODE sudo tee /etc/ceph/ceph.client.glance.keyring2 I) H! a( u2 d2 W, c* J
      [root@mon ~]# ssh GLANCE_API_NODE chown glance:glance /etc/ceph/ceph.client.glance.keyring  J" J* @! Y9 n2 U
  • OpenStack Nova nodes need the keyring file for the nova-compute process:
    [root@mon ~]# ceph auth get-or-create client.cinder | ssh NOVA_NODE tee /etc/ceph/ceph.client.cinder.keyring
  • The OpenStack Nova nodes also need to store the secret key of the client.cinderuser in libvirt. The libvirt process needs the secret key to access the cluster while attaching a block device from Cinder. Create a temporary copy of the secret key on the OpenStack Nova nodes:
    [root@mon ~]# ceph auth get-key client.cinder | ssh NOVA_NODE tee client.cinder.key
    If the storage cluster contains Ceph block device images that use the exclusive-lockfeature, ensure that all Ceph block device users have permissions to blacklist clients:
    [root@mon ~]# ceph auth caps client.ID mon 'allow r, allow command "osd blacklist"' osd 'EXISTING_OSD_USER_CAPS'
  • Return to the OpenStack Nova node:
    [root@mon ~]# ssh NOVA_NODE
  • Generate a UUID for the secret, and save the UUID of the secret for configuring nova-compute later:
    [root@nova ~]# uuidgen > uuid-secret.txtNOTE
    - ~+ \" Z3 }, w% t
    You do not necessarily need the UUID on all the Nova compute nodes. However, from a platform consistency perspective, it’s better to keep the same UUID.
  • On the OpenStack Nova nodes, add the secret key to libvirt and remove the temporary copy of the key:
    cat > secret.xml <<EOF<secret ephemeral='no' private='no'>  <uuid>`cat uuid-secret.txt`</uuid>  <usage type='ceph'>    <name>client.cinder secret</name>  </usage></secret>EOF
  • Set and define the secret for libvirt:
    [root@nova ~]# virsh secret-define --file secret.xml[root@nova ~]# virsh secret-set-value --secret $(cat uuid-secret.txt) --base64 $(cat client.cinder.key) && rm client.cinder.key secret.xml
    5 X! `" g7 N" L) O

& k# V- {) ^! a" u4 a
Additional Resources
$ p' ~) B% a: v9 V8 H, W
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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