openstack对接ceph存储

openstack 部署详情请参考:https://blog.csdn.net/qq_41786090/article/details/131301296?spm=1001.2014.3001.5501

ceph 部署详情请参考:https://blog.csdn.net/qq_41786090/article/details/131570549?spm=1001.2014.3001.5501

一.对接前基础环境构建

1.配置openstack为ceph客户端

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

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

在计算节点安装ceph:

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

2.创建osd存储池添加认证(ceph01)

[root@ceph01 ~]#  ceph osd pool create volumes 128
[root@ceph01 ~]#  ceph osd pool create vms 128
[root@ceph01 ~]#  ceph osd pool create images 128

[root@ceph01 ~]#  ceph osd pool application enable volumes rgw

[root@ceph01 ~]#  ceph osd pool application enable images rgw

[root@ceph01 ~]#  ceph osd pool application enable vms rgw

[root@ceph01 ~]#  ceph osd pool set volumes pg_autoscale_mode on

[root@ceph01 ~]#  ceph osd pool set images  pg_autoscale_mode on

[root@ceph01 ~]#  ceph osd pool set vms  pg_autoscale_mode on

3.在ceph01上,生成相应的 key 文件

[root@ceph01 ~]#  pwd   进入这个目录
/etc/ceph

[root@ceph01 ceph]#  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' -o /etc/ceph/ceph.client.cinder.keyring

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

4.把生成key文件发送到openstack的所有节点

[root@ceph01 ceph]# scp ceph.client.glance.keyring controller01:/etc/ceph/
[root@ceph01 ceph]# scp ceph.client.cinder.keyring computer01:/etc/ceph/ 
[root@ceph01 ceph]# scp ceph.client.glance.keyring controller01:/etc/ceph/
[root@ceph01 ceph]# scp ceph.client.cinder.keyring computer01:/etc/ceph/

5.在控制节点修改文件权限(controller01)

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

6.在计算节点修改文件权限

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

7.在计算节点上配置libvirt

[root@computer01 ceph]# ceph auth get-key client.cinder | tee client.cinder.key
AQCmPppg9++EKxAAeFb5gd5GpabgThKcGwtP8w==
[root@computer01 ceph]# uuidgen    每一台的uuidgen都不一样注意
3ede2ed5-a8fb-48f6-92ea-fb32db1dde1e
--------------
cat > secret.xml <<EOF
<secret ephemeral='no' private='no'>
  <uuid>3ede2ed5-a8fb-48f6-92ea-fb32db1dde1e</uuid>
  <usage type='ceph'>
    <name>client.cinder secret</name>
  </usage>
</secret>
EOF


[root@computer01 ceph]# virsh secret-define --file secret.xml
[root@computer01 ceph]# virsh secret-set-value --secret 3ede2ed5-a8fb-48f6-92ea-fb32db1dde1e --base64 $(cat client.cinder.key) && rm client.cinder.key secret.xml     
 

rm: remove regular file ‘client.cinder.key’? y
rm: remove regular file ‘secret.xml’? y

二.对接

1.对接glance服务(控制节点controller01)

[root@controller01 ~]#  vim /etc/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@controller01 ~]#  systemctl restart openstack-glance*

2.对接cinder服务(控制节点controller01)

[root@controller01 ~]#  vim /etc/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 =   3ede2ed5-a8fb-48f6-92ea-fb32db1dde1e
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@controller01 ~]# systemctl restart openstack-cinder*

3.对接nova服务(计算节点computer01)

[root@computer01 ~]# vim/etc/nova/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=3ede2ed5-a8fb-48f6-92ea-fb32db1dde1e

重启服务[root@computer01 ~]#  systemctl restart openstack-nova* 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lyt5701

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值