在ceph监视器上执行

CINDER_PASSWD='cinder1234!'
controllerHost='controller'
RABBIT_PASSWD='0penstackRMQ'

1.创建pool池

为cinder-volume服务创建pool池(因为我只有一个OSD节点,所以要将副本数设置为1)
ceph osd pool create cinder-volumes 32
ceph osd pool set cinder-volumes size 1
ceph osd pool application enable  cinder-volumes rbd
ceph osd lspools

2.查看pool池的使用情况

ceph df

3.创建账号

ceph auth get-or-create client.cinder-volumes mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=cinder-volumes, allow rwx pool=glance-images' -o /etc/ceph/ceph.client.cinder-volumes.keyring
#查看
ceph auth ls | grep -EA3 'client.(cinder-volumes)'

4.修改ceph.conf配置文件并同步到所有的监视器节点(这步一定要操作)

su - cephd
cd ~/ceph-cluster/
cat <<EOF>> ceph.conf
[client.cinder-volumes]
keyring = /etc/ceph/ceph.client.cinder-volumes.keyring
EOF
ceph-deploy --overwrite-conf admin ceph-mon01
exit

5.安装cinder-volume组件和ceph客户端(如果ceph监视器是在控制节点上不需要执行这一步)

yum -y install openstack-cinder python-keystone ceph-common

6.使用uuidgen生成一个uuid(确保cinder和libvirt中的UUID一致)

uuidgen
运行uuidgen命令可以得到下面的UUID值:

086037e4-ad59-4c61-82c9-86edc31b0bc0

7.配置cinder-volume服务与cinder-api服务进行交互

openstack-config --set  /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/cinder/cinder.conf cache backend  oslo_cache.memcache_pool
openstack-config --set /etc/cinder/cinder.conf cache enabled  true
openstack-config --set /etc/cinder/cinder.conf cache memcache_servers  ${controllerHost}:11211
openstack-config --set  /etc/cinder/cinder.conf DEFAULT auth_strategy  keystone
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_uri  http://${controllerHost}:5000
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_url  http://${controllerHost}:5000
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  auth_type password
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  project_domain_id  default
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  user_domain_id  default
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  project_name  service
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  username  cinder
openstack-config --set  /etc/cinder/cinder.conf keystone_authtoken  password  ${CINDER_PASSWD}
openstack-config --set  /etc/cinder/cinder.conf oslo_concurrency lock_path  /var/lib/cinder/tmp

8.配置cinder-volume服务使用的后端存储为ceph

openstack-config --set /etc/cinder/cinder.conf  DEFAULT  enabled_backends  ceph

9.配置cinder-volume服务驱动ceph

openstack-config --set /etc/cinder/cinder.conf  ceph volume_driver  cinder.volume.drivers.rbd.RBDDriver
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_pool  cinder-volumes
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_user cinder-volumes
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_ceph_conf  /etc/ceph/ceph.conf
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_flatten_volume_from_snapshot  false
openstack-config --set /etc/cinder/cinder.conf  ceph bd_max_clone_depth  5
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_store_chunk_size  4
openstack-config --set /etc/cinder/cinder.conf  ceph rados_connect_timeout  -1
openstack-config --set /etc/cinder/cinder.conf  ceph glance_api_version 2
openstack-config --set /etc/cinder/cinder.conf  ceph rbd_secret_uuid  086037e4-ad59-4c61-82c9-86edc31b0bc0

10.启动cinder-volume服务

systemctl enable openstack-cinder-volume.service
systemctl start openstack-cinder-volume.service
systemctl status openstack-cinder-volume.service

在需要挂载ceph卷的所有计算节点上执行

1.创建secret文件(UUID需要与cinder服务中一致)

cat << EOF > ~/secret.xml
<secret ephemeral='no' private='no'>
     <uuid>086037e4-ad59-4c61-82c9-86edc31b0bc0</uuid>
     <usage type='ceph'>
         <name>client.cinder-volumes secret</name>
     </usage>
</secret>
EOF

2.从ceph监视器上获取cinder-volumes账户的密钥环

ceph auth get-key client.cinder-volumes
得到如下的结果:
AQCxfDFdgp2qKRAAUY/vep29N39Qv7xWKYqMUw==

3.在libvirt中注册UUID

virsh secret-define --file ~/secret.xml

4.在libvirt中添加UUID和cinder-volumes密钥环

virsh secret-set-value --secret 086037e4-ad59-4c61-82c9-86edc31b0bc0 --base64 AQCxfDFdgp2qKRAAUY/vep29N39Qv7xWKYqMUw==

5.查看libvirt中添加的UUID

virsh secret-list

6.重启libvirt

systemctl restart libvirtd.service
systemctl status libvirtd.service

出错回滚的方案

1.删除pool池

先在所有的监视器节点上开启删除pool的权限,然后才可以删除。
删除pool时ceph要求必须输入两次pool名称,同时加上--yes-i-really-really-mean-it选项。
echo '
mon_allow_pool_delete = true
[mon]
mon allow pool delete = true
' >> /etc/ceph/ceph.conf
systemctl restart ceph-mon.target
ceph osd pool delete cinder-volumes cinder-volumes  --yes-i-really-really-mean-it

2.删除账号

ceph auth del client.cinder-volumes

3.删除libvirt中注册的UUID和cinder-volumes密钥环

查看:
virsh secret-list
删除(secret-undefine后跟uuid值):
virsh secret-undefine  086037e4-ad59-4c61-82c9-86edc31b0bc0

配置cinder-volume服务使用ceph作为后端存储的更多相关文章

  1. 配置cinder-backup服务使用ceph作为后端存储

    在ceph监视器上执行 CINDER_PASSWD='cinder1234!'controllerHost='controller'RABBIT_PASSWD='0penstackRMQ' 1.创建p ...

  2. 配置nova服务使用ceph作为后端存储

    在ceph监视器上执行 1.创建pool池 为nova服务创建pool池(因为我只有一个OSD节点,所以要将副本数设置为1) ceph osd pool create nova-vms 32 ceph ...

  3. Openstack入门篇(十八)之Cinder服务-->使用NFS作为后端存储

    1.安装cinder-volume组件以及nfs [root@linux-node2 ~]# yum install -y openstack-cinder python-keystone [root ...

  4. openstack的glance、nova、cinder使用ceph做后端存储

    块设备与 OPENSTACK 通过 libvirt 你可以把 Ceph 块设备用于 OpenStack ,它配置了 QEMU 到 librbd 的接口. Ceph 把块设备映像条带化为对象并分布到集群 ...

  5. Cinder Volume 服务启动流程分析和周期性任务分析

    1.cinder-volume服务的程序入口 #!/usr/bin/python2 # PBR Generated from u'console_scripts' import sys from ci ...

  6. 026-Cinder服务-->使用NFS作为后端存储

    以下将介绍如何使用NFS共享作为Openstack后端存储,本案例在计算节点上配置nfs [root@linux-node2 ~]# yum install -y openstack-cinder p ...

  7. 配置glance使用ceph作为后端存储

    在ceph监视器上执行 1.创建pool池 为glance服务创建pool池(因为我只有一个OSD节点,所以要将副本数设置为1) ceph osd pool create glance-images  ...

  8. k8s使用ceph作为后端存储挂载

    一.在ceph集群上操作: 1.创建池(主要使用存储类来进行持久卷的挂载,其他的挂载方式不好使也太麻烦):ceph osd pool create k8s 64 二.在k8s上操作: 1.安装客户端( ...

  9. 配置Ceph集群为OpenStack后端存储

    配置Ceph存储为OpenStack的后端存储 1  前期配置 Ceph官网提供的配置Ceph块存储为OpenStack后端存储的文档说明链接地址:http://docs.ceph.com/docs/ ...

随机推荐

  1. unreal 抓mobile 管线

    把renderdoc挂到生成的exe上 用命令行 “路径\xx.uproject” scenename -game -FeatureLevelES31 -windowed -resx=1920 -re ...

  2. Java 实现大文件切割并生成多个文件

    话不多说,直接上代码 import java.io.*; /*** * 分割大文件 * ( * SQL 文件太大(insert),第三方工具无法一次性读取,进行分割 * 生成 一个一个文件 * ) * ...

  3. 洛谷P1026 统计单词个数【区间dp】

    题目:https://www.luogu.org/problemnew/show/P1026 题意: 给定一个字符串,要求把他分成k段.给定s个单词,问划分成k段之后每段中包含的单词和最大是多少. 一 ...

  4. Codeforces Round #586 (Div. 1 + Div. 2) A. Cards

    链接: https://codeforces.com/contest/1220/problem/A 题意: When Serezha was three years old, he was given ...

  5. CSS测试题Ⅰ

    1.CSS 指的是? A.  Computer Style Sheets B.  Cascading Style Sheets C.  Creative Style Sheets D.  Colorf ...

  6. PHP mysqli_fetch_assoc() 函数

    从结果集中取得一行作为关联数组: <?php // 假定数据库用户名:root,密码:123456,数据库:RUNOOB $con=mysqli_connect("localhost& ...

  7. SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xce in position 0: invalid continuatio

    点击  文档>>设置文件编码>>Unicode>>Unicode(UTF-8)

  8. Codeforces 959D. Mahmoud and Ehab and another array construction task(构造, 简单数论)

    Codeforces 959D. Mahmoud and Ehab and another array construction task 题意 构造一个任意两个数都互质的序列,使其字典序大等于a序列 ...

  9. PHP面向对象学习-属性 类常量 类的自动加载 构造函数和析构函数 访问控制(可见性)

    在类的成员方法里面,可以用 ->(对象运算符):$this->property(其中 property 是该属性名)这种方式来访问非静态属性.静态属性则是用 ::(双冒号):self::$ ...

  10. 在docker 安装gitlab

    一.Centos 7 上安装 官方文档:https://docs.docker.com/install/linux/docker-ce/centos/ 1.安装环境      yum install  ...