openstack mariadb服务启动不了_Ceph对接OpenStack

本文详细介绍了OpenStack如何对接Ceph存储系统,包括对接前的准备工作和具体的对接步骤,如安装相关软件包,配置Ceph集群的访问权限,创建存储池,以及在OpenStack组件中进行相应配置。同时,文章提及了对接过程中可能出现的问题及解决策略。
摘要由CSDN通过智能技术生成

94d85c11f99c7f9cbd6b043a5c1118db.png

当你讨论OpenStack中的存储时,Ceph就会受到关注。这是因为Ceph提供了OpenStack所需要的强健,可靠的存储后端。主要表现在Ceph为OpenStack云环境提供了先进的块存储能力,虚拟机的快速启动,备份以及复制,还提供了持久化的卷级块照的备份。

对接前的准备:

Ceph已经成为openstack后端存储的成熟方案。Openstack对接Ceph,有3大模块可以使用Ceph:

1.镜像:Openstack的Glance组件提供镜像服务,可以将Image直接存储在Ceph中。

2.操作系统盘:Openstack的Nova组件提供计算服务,一个虚机的创建必然需要操作系统,也就少不了系统盘,系统盘可以使用Ceph来提供。

3.非操作系统盘:Openstack的Cinder组件提供块存储服务,也就是我们物理机中的普通磁盘,也可以通过Ceph来提供。

对接前确保ceph集群和openstack集群的功能都正常,特别是openstack的cinder、nova-compute、glance等服务。要清楚的知道openstack哪些节点上对应哪些服务。

通常glance服务在controller节点上,nove-compute服务在compute节点上,cinder服务即可以在controller,也可以在compute,也可以独立的storage节点。

对接过程:

1、在glance-api的主机上安装python-rbd包:

yum install python-rbd

2、nova-compute、cinder-volume节点上安装ceph-common包:

yum install ceph-common

3、把ceph集群的/etc/ceph/ceph.conf 、/etc/ceph/ceph.client.admin.keyring 文件拷贝到openstack节点的/etc/ceph目录下,确保openstack对应节点成为ceph集群的客户端

4、在ceph集群创建三个pool ,分别对应上文三个模块。以后所有的OpenStack虚拟机数据都会存储到这三个池中。

创建volumes池,对应Cinder服务

    ceph osd pool create os_volumes 128

创建images池,对应Glance服务

    ceph osd pool create os_images 128

创建vms池,对应Nova服务

    ceph osd pool create os_vms 128

5、在ceph集群创建cinder、glance等用户,并做了权限控制。

  ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=os_volumes, allow rwx pool=os_vms, allow rx pool=os_images'
  ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=os_images'

6、将上面生成的keyring文件,保存在相应的节点上,并修改为相应的权限。(在ceph端执行)

ceph auth get-or-create client.glance | ssh {your-glance-api-server} sudo tee /etc/ceph/ceph.client.glance.keyring
ssh {your-glance-api-server} sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring
ceph auth get-or-create client.cinder | ssh {your-volume-server} sudo tee /etc/ceph/ceph.client.cinder.keyring
ssh {your-cinder-volume-server} sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring

7、在nova-compute节点上保存和cinder-volume相同的keyring

ceph auth get-or-create client.cinder | ssh {your-nova-compute-server} sudo tee /etc/ceph/ceph.client.cinder.keyring

8、 在openstack集群所有compute节点libvirt上添加secret key

8.1:从ceph集群获取cinder keyring,并保存到nova-comute对应节点/root目录下一个临时文件中

                 ceph auth get-key client.cinder | ssh {your-compute-node} tee client.cinder.key 

(执行完这句话后nova-compute节点的/root下会出现临时的文件)

8.2在compute节点生成一个UUID

          uuidgen

比如生成:457eb676-33da-42ec-9a8c-9293d545c337

8.3 /root下touch一个文件 secret.xml 内容如下:

   <secret ephemeral='no' private='no'>
          <uuid>457eb676-33da-42ec-9a8c-9293d545c337</uuid>
          <usage type='ceph'>
          <name>client.cinder secret</name>
          </usage>
    </secret>

8.4

    virsh secret-define --file secret.xml
    virsh secret-set-value --secret 457eb676-33da-42ec-9a8c-9293d545c337 --base64 $(cat client.cinder.key) && rm client.cinder.key secret.xml

9、配置glance节点/etc/glance/glance-api.conf

在DEFAULT域中增加:

[DEFAULT]
default_store = rbd  //(默认是file,要修改)

在glance_store域中增加如下,如果没有glance_store域,直接创建:

[glance_store]
stores = rbd
rbd_store_pool = os_images
rbd_store_user = glance
rbd_store_ceph_conf = /etc/ceph/ceph.conf
rbd_store_chunk_size = 8

10.配置cinder节点的/etc/cinder/cinder.conf

在DEFAULT域中增加:

[DEFAULT]
enabled_backends = ceph

在ceph域中增加如下,如果没有ceph域,直接创建:

[ceph]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = os_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 = 457eb676-33da-42ec-9a8c-9293d545c337

11、配置nova-compute节点/etc/nova/nova.conf中添加如下:

[libvirt]
images_type = rbd
images_rbd_pool = os_vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_user = cinder
rbd_secret_uuid = 457eb676-33da-42ec-9a8c-9293d545c337
disk_cachemodes="network=writeback"

12.对应节点重启服务:

systemctl restart openstack-glance-api 
systemctl restart openstack-nova-compute 
systemcyl restart openstack-cinder-volume 

13.openstack的dashboard中测试创建卷、生成镜像和卷生成虚拟机等操作。有空再写一篇文章来讲解具体测试。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值