首页 > 其他分享 >openstack ceph

openstack ceph

时间:2022-12-09 14:36:19浏览次数:59  
标签:ceph etc client cinder openstack rbd root

OpenStack集成ceph详细过程可以查看ceph官方文档:ceph document

OpenStack Queens版本,1台控制节点controller,1台计算节点compute;

1. 创建存储池

  1. Glance:Glance可以把镜像存储在Ceph上;

  2. Cinder:Cinder负责管理volume,把volume挂载给instance使用或者直接从volume启动instance。集成Ceph后可以让Cinder在Ceph上创建volume;

  3. Nova:在OpenStack Havana版本开始,Nova可以直接把instance的disk存放在Ceph上。

在Ceph集群上总共创建3个存储池,分别给Glance,Cinder和Nova使用;

  1. backups: 存放备份文件

2. 配置OpenStack的ceph客户端

2.1. 拷贝ceph.conf

把Ceph的配置文件/etc/ceph/ceph.conf拷贝到2台OpenStack节点上,控制节点和计算节点都需要,因为他们都要跟Ceph通信。

ssh {your-openstack-server} sudo tee /etc/ceph/ceph.conf </etc/ceph/ceph.conf

注意:

运行着 glance-api 、 cinder-volume 、 nova-compute 或 cinder-backup 的主机被当作 Ceph 客户端,它们都需要 ceph.conf 文件。

2.2. 安装软件包

在控制节点安装python-rbd和ceph软件包:

[root@controller   ~]# yum install -y python-rbd ceph

在计算节点安装ceph:

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

注意: 如果不安装ceph,OpenStack在使用Ceph时会报找不到ceph命令。

2.3. 配置cephx认证

创建client.cinder用户给Cinder和Nova使用,cinder用户有存储池volumes、vms、images的所有权限

[root@ceph1 ~]# 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.glance用户给Glance使用,glance用户有存储池images的所有权限

[root@ceph1 ~]# ceph auth get-or-create client.glance mon 'allow   r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

生成2个用户的密钥文件,

[root@ceph1 ~]# ceph auth   get-or-create client.cinder > /etc/ceph/ceph.client.cinder.keyring

[root@ceph1 ~]# ceph auth   get-or-create client.glance > /etc/ceph/ceph.client.glance.keyring

然后把/etc/ceph/ceph.client.cinder.keyring和/etc/ceph/ceph.client.glance.keyring拷到controller的/etc/ceph下,并且修改文件权限:

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

[root@controller ~]# chown   glance:glance /etc/ceph/ceph.client.glance.keyring

把/etc/ceph/ceph.client.cinder.keyring拷到compute的/etc/ceph下,并且修改文件权限:

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

2.4. 配置compute节点的libvirt

在ceph上获取client.cinder的key

[root@ceph1 ~]# ceph auth get-key   client.cinder > client.cinder.key

把client.cinder.key拷到compute节点的/etc/ceph下,在compute节点上执行以下步骤:

[root@compute ~]# cat > secret.xml <<EOF
<secret   ephemeral='no' private='no'>   <uuid>e21a123a-31f8-425a-86db-7204c33a6161</uuid> <usage   type='ceph'> <name>client.cinder secret</name> </usage>   </secret>
EOF
[root@compute ~]# virsh secret-define --file secret.xml
[root@compute ~]# virsh secret-set-value --secret e21a123a-31f8-425a-86db-7204c33a6161   --base64 $(cat /etc/ceph/client.cinder.key) && rm client.cinder.key   secret.xml

3. 配置Glance

修改glance-api.conf,

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

重启Glance服务,

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

4. 配置Cinder

修改cinder.conf

[DEFAULT]
......
enabled_backends = ceph
[ceph]
rbd_pool = volumes
rbd_user = cinder
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false
rbd_secret_uuid =   e21a123a-31f8-425a-86db-7204c33a6161
rbd_max_clone_depth = 5
rbd_store_chunk_size = 4
rados_connect_timeout = -1
volume_driver = cinder.volume.drivers.rbd.RBDDriver
volume_backend_name = ceph

重启Cinder服务,

[root@controller   ~]# systemctl restart openstack-cinder-api openstack-cinder-volume

5. 配置Nova

修改compute节点的nova.conf,

[libvirt]
virt_type=kvm
inject_password=false
inject_key=false
inject_partition=-2
disk_cachemodes = "network=writeback"
images_type=rbd
images_rbd_pool=vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
hw_disk_discard=unmap
rbd_user=cinder
rbd_secret_uuid=e21a123a-31f8-425a-86db-7204c33a6161

重启nova-compute服务,

[root@compute ~]# systemctl restart   openstack-nova-compute

6. 验证

创建测试镜像

[root@controller ~]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
#Glance以Ceph RBD为后端存储时只支持raw格式,不是raw格式创建实例时会出错
[root@controller ~]# qemu-img convert -f   qcow2 -O raw cirros-0.4.0-x86_64-disk.img cirros-0.4.0-x86_64-disk.raw
[root@controller ~]# openstack image   create "cirros"   --file   cirros-0.4.0-x86_64-disk.raw     --disk-format raw --container-format bare   --public

有两种在Ceph上启动实例的方式:

  1. 以镜像为基础创建可启动的卷,然后启动实例时选择boot-from-volume,选择此卷;

  2. 直接使用镜像创建实例,这种用法是Havana版本后才支持的。

创建实例

​ 测试

7. 总结

OpenStack集成ceph,作为cinder、nova、glance的后端存储,整体过程:

(1)搭建ceph集群,在Ceph集群上总共创建4个存储池,分别给Glance,Cinder,Nova和backup使用

(2)将Ceph的配置文件/etc/ceph/ceph.conf拷贝到2台OpenStack节点,以便节点可以和ceph集群进行通信,运行着 glance-api 、 cinder-volume 、 nova-compute 或 cinder-backup 的主机被当作 Ceph 客户端,它们都需要 ceph.conf 文件。

(3)在OpenStack中配置ceph客户端

(4)修改Glance的配置文件,支持ceph后端存储

(5)修改Cinder的配置文件,支持ceph后端存储

(6)修改Nova的配置文件,支持ceph后端存储

上述过程完成后,即可将OpenStack的所有存储工作交给ceph来管理,在OpenStack数据的容灾备份方面即有ceph来接管。

标签:ceph,etc,client,cinder,openstack,rbd,root
From: https://www.cnblogs.com/ruiy/p/16968861.html

相关文章

  • ceph 集群 健康状态报 clock skew detected on mon.tg-ceph-mon-2
    1.现象:health:HEALTH_WARNnoactivemgrmonsareallowinginsecureglobal_idreclaimclockskewdetectedonmon.tg-ceph-mon-2......
  • ceph 集群 报"daemons have recently crashed" 问题处理
    原因:.产生该问题的原因是数据在均衡或者回滚等操作的时候,导致其某个守护进程崩溃了,且没有及时归档,所以集群产生告警解决办法:cephcrashlscephcrasharchive<id>ORceph......
  • openstack介绍及原理
     openstack项目搭建:1、环境布署2、配置keystone服务3、配置glance服务4、配置placement服务5、配置nova服务控制节点6、配置nova服务计算节点7、配置neutron服务控制节点......
  • openstack上传镜像到glance
    以qcow2模板为例1.上传镜像qcow2文件到服务器。2.先转换qcow2格式为raw,例如:qemu-imgconvert-fqcow2-Orawwin2012r2.qcow2win2012r2.raw3.再将raw镜像上传到gl......
  • openstack安装(超详细)
    1、系统环境配置2、keystone(认证)3、glance(镜像)4、compute(计算)5、network(网络)6、dashboard(仪表盘)7、cinder(块存储)8、部署、对接ceph存储集群9、运营、......
  • 基于现有Kubernetes集群使用Rook部署Ceph集群
    基于现有Kubernetes集群使用Rook部署Ceph集群一、前言本片文章主要是基于现有的k8s集群环境使用Rook部署Ceph集群Rook官方文档:https://rook.github.io/docs......
  • 04 Ceph 集群管理(转载)
    目录Ceph集群管理Ceph资源对象monitor、mgr和osd、csiprovisioner以Deployments的形式部署CSI的CephFS驱动和RBD驱动以DaemonSets的方式部署对外提供服务均......
  • BoCloud博云加入Ceph基金会,助力开源事业前进发展
    近日,BoCloud博云正式加入Ceph基金会,将与其他基金会成员共同探讨和推动Ceph在全球的发展,共同致力于解决数据存储和数据服务的爆炸性增长。Ceph基金会是由Linux基金会于......
  • the--openssl升级引起的openstack服务异常问题
    1.问题查看openstack服务,各个服务报错提示:  PAMunabletodlopen(/lib64/security/pam_tally.so):/lib64/security/pam_tally.so:cannotopensharedobjectfile......
  • OpenStack跨CPU热迁移失败处理
    1.注释libvirt的CPU检测代码所有计算节点vim/usr/lib/python3/dist-packages/nova/virt/libvirt/driver.py'''9342#try:9343#ifnotins......