环境准备:

保证openstack节点的hosts文件里有ceph集群的各个主机名,也要保证ceph集群节点有openstack节点的各个主机名

一、使用rbd方式提供存储如下数据:

(1)image:保存glanc中的image;
 
(2)volume存储:保存cinder的volume;保存创建虚拟机时选择创建新卷;
 
 
 

二、实施步骤:

(1)客户端也要有cent用户:

useradd cent && echo "123" | passwd --stdin cent
echo -e 'Defaults:cent !requiretty\ncent ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/ceph
chmod 440 /etc/sudoers.d/ceph

(2)openstack要用ceph的节点(比如compute-node和storage-node)安装下载的软件包:

  yum localinstall ./* -y

或则:每个节点安装 clients(要访问ceph集群的节点):

yum install python-rbd
yum install ceph-common

(3)部署节点上执行,为openstack节点安装ceph:

ceph-deploy install controller
     ceph-deploy admin controller

(4)客户端执行

sudo chmod 644 /etc/ceph/ceph.client.admin.keyring

5)创建存储池,分别名为images、vms、volumes

[root@controller ~]#ceph osd pool create images 128
pool 'images' created
[root@controller ~]# ceph osd pool create vms 128
pool 'vms' created
[root@controller ~]# ceph osd pool create volumes 128
pool 'volumes' created

6)查看pool列表

ceph osd lspools

0 rbd,1 images,2 vms,3 volumes,

如果你启用了 cephx 认证,需要分别为 Nova/Cinder 和 Glance 创建新用户

7)在ceph集群中创建glance和cinder用户,由于是all in one环境所以这里我们就在部署节点上创建这两个用户即可。

  useradd glance

  useradd cinder

8)给与这两个用户输出一个对应的密钥环

[root@controller ceph]# 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 = AQCZggNd3TrTDBAAFgWrEAXhXt7xv4xcnn0eWA==
[root@controller 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'
[client.cinder]

key = AQCtggNdHrFuHhAAsI/rt4cVujt8QEYZOODRFw==

每创建一个用户会输出一个对应用户的秘钥环,秘钥环是其他节点访问集群的钥匙(client.glance/cinder )

9)拷贝密钥环,并发给需要的节点,我们这里就在controller节点上拷贝然后发给storage节点

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

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

[root@controller ceph]# scp ceph.client.glance.keyring ceph.client.cinder.keyring compute:/etc/ceph/
ceph.client.glance.keyring 100% 64 15.4KB/s 00:00
ceph.client.cinder.keyring 100% 64 31.4KB/s 00:00
[root@controller ceph]# scp ceph.client.glance.keyring ceph.client.cinder.keyring storage:/etc/ceph/
ceph.client.glance.keyring 100% 64 14.1KB/s 00:00
ceph.client.cinder.keyring 100% 64 28.0KB/s 00:00

10)更改下面keyring文件的属组属组,不然没有权限访问。

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

注意:必须已经在controller节点上安装过ceph包,也就是要有/etc/ceph这个文件夹,完成后可以在controller下面的/etc/ceph目录下看到ceph.client.glance.keyring秘钥环

运行着 glance-api 、 cinder-volume 、 nova-compute 或 cinder-backup 的主机被当作 Ceph 客户端

11)更改libvirt权限,只需要在nova-compute节点上操作就行

生成一个uuid,并将uuid写入/etc/ceph/uuid

[root@compute ceph]# uuidgen
3e3314c9-bfb0-439e-8764-61896c621b7e

 [root@compute ceph]# vim uuid

3e3314c9-bfb0-439e-8764-61896c621b7e

在/etc/ceph目录下创建secret文件,添加以下内容

cat > secret.xml <<EOF
<secret ephemeral='no' private='no'>
<uuid>940f0485-e206-4b49-b878-dcd0cb9c70a4</uuid>
<usage type='ceph'>
<name>client.cinder secret</name>
</usage>
</secret>

将secret文件发送到其他compute节点,并执行以下操作

[root@compute ceph]# ceph auth get-key client.cinder > ./client.cinder.key
[root@compute ceph]# ls
ceph.client.admin.keyring ceph.conf secret.xml
ceph.client.cinder.keyring client.cinder.key tmpJKjseK
ceph.client.glance.keyring rbdmap uuid
[root@compute ceph]# virsh secret-set-value --secret 3e3314c9-bfb0-439e-8764-61896c621b7e --base64 $(cat ./client.cinder.key)
secret 值设定
如遇如下错误:
[root@controller ceph]# virsh secret-define --file secret.xml
 
错误:使用 secret.xml 设定属性失败
错误:internal error: 已将 UUID 为d448a6ee-60f3-42a3-b6fa-6ec69cab2378 的 secret 定义为与 client.cinder secret 一同使用。
将重复的uuid取消定义再将secret文件取消定义。 
 
[root@controller ~]# virsh secret-list
UUID                                  用量
--------------------------------------------------------------------------------
d448a6ee-60f3-42a3-b6fa-6ec69cab2378  ceph client.cinder secret
 
[root@controller ~]# virsh secret-undefine d448a6ee-60f3-42a3-b6fa-6ec69cab2378
已删除 secret d448a6ee-60f3-42a3-b6fa-6ec69cab2378
 
[root@controller ~]# virsh secret-list
UUID                                  用量
--------------------------------------------------------------------------------
 
[root@controller ceph]# virsh secret-define --file secret.xml
生成 secret 940f0485-e206-4b49-b878-dcd0cb9c70a4
 
[root@controller ~]# virsh secret-list
UUID                                  用量
--------------------------------------------------------------------------------
940f0485-e206-4b49-b878-dcd0cb9c70a4  ceph client.cinder secret
 
virsh secret-set-value --secret 940f0485-e206-4b49-b878-dcd0cb9c70a4 --base64 $(cat ./client.cinder.key)
 
 

15)在horizon页面删除镜像和实例

16)在controller节点上修改glance-api.conf配置文件,然后重启

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

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

17)查看并重新创建image镜像

[root@controller ceph]# openstack image create "cirros"   --file cirros-0.3.3-x86_64-disk.img --disk-format qcow2 --container-format bare --public

更改后镜像就存储在ceph集群glance pool里。

18)storage节点上修改cinder配置文件(两处),并重启controller节点相关服务和storage节点相关服务

enabled_backends = ceph

[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 = 3e3314c9-bfb0-439e-8764-61896c621b7e
volume_backend_name=ceph

systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service(controller节点)

systemctl restart openstack-cinder-volumes(storage节点)

19)horizon界面创建卷验证

[root@controller gfs]# rbd ls volumes
volume-43b7c31d-a773-4604-8e4a-9ed78ec18996

20)在nova-compute节点修改nova配置文件,重启controller的nova相关服务和storage节点的相关服务

[libvirt]
virt_type=qemu
images_type = rbd
images_rbd_pool = vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_user = cinder
rbd_secret_uuid = 3e3314c9-bfb0-439e-8764-61896c621b7e
 
systemctl restart openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service  openstack-nova-compute.service openstack-nova-cert.service    (controller节点)
 
systemctlr restart openstack-nova-compute  (compute节点)
 
 

21)horizon界面创建虚拟机验证

ceph对接openstack环境(4)的更多相关文章

  1. ceph对接openstack环境

    环境准备: 保证openstack节点的hosts文件里有ceph集群的各个主机名,也要保证ceph集群节点有openstack节点的各个主机名 一.使用rbd方式提供存储如下数据: (1)image ...

  2. ceph 对接openstack liberty

    Ceph 准备工作 官方文档:http://docs.ceph.com/docs/master/rbd/rbd-openstack/ 官方中文文档:http://docs.ceph.org.cn/rb ...

  3. ceph对接openstack

    一.使用rbd方式提供存储如下数据: (1)image(glance):保存glanc中的image: (2)volume(cinder)存储:保存cinder的volume:保存创建虚拟机时选择创建 ...

  4. OpenStack学习系列之十二:安装ceph并对接OpenStack

        Ceph 是一种为优秀的性能.可靠性和可扩展性而设计的统一的.分布式文件系统.Ceph 的统一体现在可以提供文件系统.块存储和对象存储,分布式体现在可以动态扩展.在国内一些公司的云环境中,通常 ...

  5. “CEPH浅析”系列之六——CEPH与OPENSTACK

    在 <"Ceph浅析"系列之二--Ceph概况>中即已提到,关注Ceph的原因之一,就是OpenStack社区对于Ceph的重视.因此,本文将对Ceph在OpenSta ...

  6. Ceph在OpenStack中的地位

    对Ceph在OpenStack中的价值进行简要介绍,并且对Ceph和Swift进行对比. 对于一个IaaS系统,涉及到存储的部分主要是块存储服务模块.对象存储服务模块.镜像管理模块和计算服务模块.具体 ...

  7. Ceph与OpenStack整合(仅为云主机提供云盘功能)

    1. Ceph与OpenStack整合(仅为云主机提供云盘功能) 创建: linhaifeng,最新修改: 大约1分钟以前 ceph ceph osd pool create volumes 128 ...

  8. The Dos and Don'ts for Ceph for OpenStack

    Ceph和OpenStack是一个非常有用和非常受欢迎的组合. 不过,部署Ceph / OpenStack经常会有一些容易避免的缺点 - 我们将帮助你解决它们 使用 show_image_direct ...

  9. 用命令测试安装好的OpenStack环境

    OpenStack三个节点icehouse-gre模式部署一文部署了一套OpenStack环境,接下来使用命令测试一遍. 首先要明确几个概念: 外网:可分配floating ip绑定到虚拟机,外部就可 ...

随机推荐

  1. 屏蔽恶意IP

    #!/bin/bash cat /var/log/secure | grep Failed | awk -F " " '{print $11}'| sort| uniq -c| a ...

  2. JSON添加注释的问题

    JSON有两种数据结构: 名称/值对的集合:key : value样式: 值的有序列表:就是Array: 而在JSON的文档中说明只要是不符合上面两种结构的都不被支持,并提示错误 添加注释//或者/* ...

  3. BIO、NIO、AIO 有什么区别?(未完成)

    BIO.NIO.AIO 有什么区别?(未完成)

  4. websocket链接报错 ERR_CONNECTION_TIME_OUT

    每次打开页面都会报这个错误,链接超时,之前一直是可以的,查看日志之后发现链接数据库失败,修改启动配置文件,修改数据库配置信息,我准备数据库配置信息写死了,然后启动.解决!!!!

  5. Python MySQL 数据库连接不同方式

    PyMySQL 驱动连接 什么是 PyMySQL?PyMySQL 是在 Python3.x 版本中用于连接 MySQL 服务器的一个库,Python2中则使用mysqldb. PyMySQL 遵循 P ...

  6. C# 集合(9) 持续更新

    数组的大小是固定的.如果元素个数动态,就使用集合类. List<T>是与数组相当的集合类.其他的集合:队列.栈.链表.字典和集. .NET Framework 1.0 包括非泛型集合类,如 ...

  7. flutter 跳转至根路由

    上代码 //flutter 登录后跳转到根路由 Navigator.of(context).pushAndRemoveUntil( new MaterialPageRoute(builder: (co ...

  8. 自己编写一个Java监听器

    Java监听器 1.原理: 当范围对象的状态发生变化的时候,服务器自动调用监听器对象中的方法. 例如:创建一个“人”类Class Person 人拥有吃的方法public void eat(){},我 ...

  9. For 循环的嵌套与九九乘法表

    ㈠通过程序,在页面中输入如下图形 * * * * * * * * * * * * * * * * * * * * * * * * *  代码如下: //向body中输入一个内容 //document. ...

  10. CSS测试题Ⅱ

    1.如何使用 CSS3 强制换行? A. word-wrap: break-word; B. text-wrap: break-word; C. text-wrap: force; D. text-w ...