基于Ceph14对接openstack的Nova、Glance、Cinder服务为后端存储

server/2025/2/6 15:25:33/

openstack对接ceph后端存储

    • 对接glance后端存储
    • 对接nova后端存储
    • 对接cinder后端存储

openstack T版对接ceph 14版本做glance、nova、cinder后端存储,openstack集群和ceph集群均搭建完毕

节点IP
controller192.168.200.10
compute192.168.200.20
storage01192.168.200.30
storage02192.168.200.31
storage03192.168.200.32

创建cinder、glance、nova存储池

[root@storage01 ceph-cluster]# ceph osd pool create volumes 8
pool 'volumes' created
[root@storage01 ceph-cluster]# ceph osd pool create images 8
pool 'images' created
[root@storage01 ceph-cluster]# ceph osd pool create vms 8
pool 'vms' created
[root@storage01 ceph-cluster]# ceph osd lspools
4 volumes
5 images
6 vms

创建用户以及密钥

[root@storage01 ceph-cluster]# 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"
[client.cinder]key = AQDRE3tkDVGeFxAAPkGPKGlqh74pRl2dzIJXAw==
[root@storage01 ceph-cluster]# ceph auth get-or-create client.glance mon "allow r" osd "allow class-read object_prefix rbd_children,allow rwx pool=images"
[client.glance]key = AQDaE3tkKTQCIRAAwRQ/VeIjL4G5GjmsJIbTwg==
[root@storage01 ceph-cluster]#

openstack节点创建ceph目录,T版计算节点默认创建了

[root@controller ~]# mkdir /etc/ceph/

ceph导出密钥glance和cinder,并导入到opesntack

[root@storage01 ceph-cluster]# ceph auth get client.glance -o ceph.client.glance.keyring
exported keyring for client.glance
[root@storage01 ceph-cluster]# ceph auth get client.cinder -o ceph.client.cinder.keyring
exported keyring for client.cinder
[root@storage01 ceph-cluster]#
[root@storage01 ceph-cluster]# scp ceph.client.glance.keyring root@192.168.200.10:/etc/ceph/
[root@storage01 ceph-cluster]# scp ceph.client.glance.keyring root@192.168.200.20:/etc/ceph/
[root@storage01 ceph-cluster]# scp ceph.client.cinder.keyring root@192.168.200.10:/etc/ceph/
[root@storage01 ceph-cluster]# scp ceph.client.cinder.keyring root@192.168.200.20:/etc/ceph/

拷贝认证文件到集群

[root@storage01 ceph-cluster]# scp ceph.conf root@192.168.200.20:/etc/ceph/
[root@storage01 ceph-cluster]# scp ceph.conf root@192.168.200.10:/etc/ceph/

计算节点添加libvirt密钥

[root@compute ~]# cd /etc/ceph/
[root@compute ceph]# UUID=$(uuidgen)
cat >> secret.xml << EOF
<secret ephemeral='no' private='no'><uuid>$UUID</uuid><usage type='ceph'><name>client.cinder secret</name></usage>
</secret>
EOF
[root@compute ceph]# virsh secret-define --file secret.xml
Secret 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839 created
[root@compute ceph]# cat ceph.client.cinder.keyring
[client.cinder]key = AQDRE3tkDVGeFxAAPkGPKGlqh74pRl2dzIJXAw==caps mon = "allow r"caps osd = "allow class-read object_prefix rbd_children,allow rwx pool=volumes,allow rwx pool=vms,allow rx pool=images"#设置secret
[root@compute ceph]# virsh secret-set-value --secret ${UUID} --base64 $(cat ceph.client.cinder.keyring | grep key | awk -F ' ' '{print $3}')
Secret value set[root@compute ceph]# virsh secret-listUUID                                  Usage
--------------------------------------------------------------------------------8ea0cbae-86a9-4c1c-9f03-fd4b144b8839  ceph client.cinder secret[root@compute ceph]#

安装客户端工具,需计算节点添加ceph的yum源

[root@controller ~]# yum install -y ceph-common
[root@compute ~]# yum install -y ceph-common

对接glance后端存储

更改配置文件属性

[root@controller ~]# chown glance.glance /etc/ceph/ceph.client.glance.keyring
[root@controller ~]# vi /etc/glance/glance-api.conf
[glance_store]
#stores = file,http
#default_store = file
#filesystem_store_datadir = /var/lib/glance/images/
stores = rbd
default_store = rbd
show_image_direct_url = True
rbd_store_pool = images
rbd_store_user = glance
rbd_store_ceph_conf = /etc/ceph/ceph.conf
rbd_store_chunk_size = 8

重启服务

[root@controller ~]# systemctl restart openstack-glance*

测试

[root@controller ~]# openstack image create --disk-format qcow2 cirros-ceph --file /opt/iaas/images/cirros-0.3.4-x86_64-disk.img
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2023-06-03T14:36:37Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/c015136d-f3e0-4150-abd2-f7fd3fd6dbd7/file                                                                                                                                       |
| id               | c015136d-f3e0-4150-abd2-f7fd3fd6dbd7                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | cirros-ceph                                                                                                                                                                                |
| owner            | fb7a2a10b81f43fcbf4ccef895c56937|
| properties       | os_hash_algo='sha512', os_hash_value='1b03ca1bc3fafe448b90583c12f367949f8b0e665685979d95b004e48574b953316799e23240f4f739d1b5eb4c4ca24d38fdc6f4f9d8247a2bc64db25d6bbdb2', os_hidden='False' |
| protected        | False|
| schema           | /v2/schemas/image|
| size             | 13287936|
| status           | active|
| tags             ||
| updated_at       | 2023-06-03T14:36:42Z|
| virtual_size     | None|
| visibility       | shared|
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@controller ~]#

ceph节点查看

[root@storage01 ceph]# rbd ls images
c015136d-f3e0-4150-abd2-f7fd3fd6dbd7

openstack创建镜像id对应一致

对接nova后端存储

修改计算节点配置文件

[root@compute ceph]# vi /etc/nova/nova.conf
[DEFAULT]
.....
live_migration_flag = "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE"[libvirt]
images_type = rbd
images_rbd_pool = vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_user = cinder
rbd_secret_uuid = 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839

重启服务

[root@compute ceph]# systemctl restart openstack-nova-compute.service

测试

[root@controller ~]# openstack server list
+--------------------------------------+------+--------+--------------------+-------------+---------+
| ID                                   | Name | Status | Networks           | Image       | Flavor  |
+--------------------------------------+------+--------+--------------------+-------------+---------+
| d999b371-9e98-4cdb-98b8-407e900c631c | test | ACTIVE | int-net=10.0.0.206 | cirros-ceph | m1.tiny |
+--------------------------------------+------+--------+--------------------+-------------+---------+
[root@storage01 ceph]# rbd ls vms
d999b371-9e98-4cdb-98b8-407e900c631c_disk

对接cinder后端存储

修改文件属性,集群节点

[root@controller ~]# chown cinder.cinder /etc/ceph/ceph.client.cinder.keyring
[root@compute ~]# chown cinder.cinder /etc/ceph/ceph.client.cinder.keyring

修改配置文件,控制节点

[root@controller ~]# vi /etc/cinder/cinder.conf
[DEFAULT]
.....
default_volume_type = ceph

重启服务

[root@controller ~]# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service httpd

修改文件,计算节点

[root@compute ceph]# vi /etc/cinder/cinder.conf
[DEFAULT]
.....
enabled_backends = ceph,lvm[ceph]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = volumes
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false
rbd_max_clone_depth = 5
rbd_store_chunk_size = 4
rados_connect_timeout = -1
glance_api_version = 2
rbd_user = cinder
rbd_secret_uuid = 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839
volume_backend_name = ceph

重启服务

[root@compute ceph]# systemctl restart openstack-cinder-volume.service

测试

[root@controller ~]# openstack volume type create ceph
+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| description | None                                 |
| id          | c357956b-2521-439d-af59-ae2e9cc5c5aa |
| is_public   | True                                 |
| name        | ceph                                 |
+-------------+--------------------------------------+
[root@controller ~]# openstack volume create ceph-test --type ceph --size 1+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2023-06-03T15:36:09.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | fdf6c10a-31dc-4245-ae7b-b7bc0e24477d |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | ceph-test                            |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | ceph                                 |
| updated_at          | None                                 |
| user_id             | 9ff19a0bedd5461aa3fff4a80f10054c     |
+---------------------+--------------------------------------+
[root@controller ~]#
[root@storage01 ceph]# rbd ls volumes
volume-fdf6c10a-31dc-4245-ae7b-b7bc0e24477d

卷id相同,验证成功


http://www.ppmy.cn/server/165437.html

相关文章

手机上运行AI大模型(Deepseek等)

最近deepseek的大火&#xff0c;让大家掀起新一波的本地部署运行大模型的热潮&#xff0c;特别是deepseek有蒸馏的小参数量版本&#xff0c;电脑上就相当方便了&#xff0c;直接ollamaopen-webui这种类似的组合就可以轻松地实现&#xff0c;只要硬件&#xff0c;如显存&#xf…

android 音视频系列引导

音视频这块的知识点自己工作中有用到&#xff0c;一直没有好好做一个总结&#xff0c;原因有客观和主观的。 客观是工作太忙&#xff0c;没有成段时间做总结。 主观自己懒。 趁着这次主动离职拿了n1的钱&#xff0c;休息一下&#xff0c;对自己的人生做一下总结&#xff0c;…

【TensorFlow】T1:实现mnist手写数字识别

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 1、设置GPU import tensorflow as tf gpus tf.config.list_physical_devices("GPU")if gpus:gpu0 gpus[0]tf.config.experimental.set_memory_g…

crewai框架第三方API使用官方RAG工具(pdf,csv,json)

最近在研究调用官方的工具&#xff0c;但官方文档的说明是在是太少了&#xff0c;后来在一个视频里看到了如何配置&#xff0c;记录一下 以PDF RAG Search工具举例&#xff0c;官方文档对于自定义模型的说明如下&#xff1a; 默认情况下&#xff0c;该工具使用 OpenAI 进行嵌…

Vue 图片引用方式详解:静态资源与动态路径访问

目录 前言1. 引用 public/ 目录2. assets/ 目录3. 远程服务器4. Vue Router 动态访问5. 总结6. 扩展&#xff08;图片不显示&#xff09; 前言 &#x1f91f; 找工作&#xff0c;来万码优才&#xff1a;&#x1f449; #小程序://万码优才/r6rqmzDaXpYkJZF 在 Vue 开发中&#x…

糖果(安师大)

转移方程 转移方程的核心思想是 选择和不选择当前物品 两种情况的比较。具体来说&#xff1a; 不选择当前物品&#xff1a; 如果不选择第 i 个物品&#xff0c;那么 dp(i, j) 就等于 dp(i-1, j)&#xff0c;即前 i-1 个物品中&#xff0c;满足 总价值 % k j 的最大和。 选…

河洛理数【陈抟】同年月日时生的分辨

相信大家和我都有一个疑问&#xff1a;就是同年月日时出生的人比比皆是&#xff0c;但是这些人八字虽相同&#xff0c;而贫贱富贵却相差很大&#xff0c;那是什么原因导致得&#xff1f;此篇章节陈抟给出了说明。 首先针对原来存在的两点论调陈抟进行了证伪。第一点就是方位不同…

websocket 实现前后端通信

1.spring boot 引入依赖 <dependency><!-- websocket --><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId></dependency> 2.添加配置类 import org.springframework.context.a…