一、ceph & openstack可集成部分
- cinder
- glance
- nova
二、ceph&openstack cinder集成
功能支持:
- ceph rbd作为cinder存储后端,完整的实现了cinder的接口
集成步骤:
- 在ceph中创建池供openstack使用
ceph osd pool create dk-pool 2048 2048
- ceph中创建相关的账号,并设置权限,dk-cinder 用于访问dk-pool
ceph auth get-or-create client.dk-cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=dk-pool'
- 同步ceph配置到openstack节点中(openstack将使用此配置访问ceph集群)
ssh {your-openstack-server} sudo tee /etc/ceph/ceph.conf </etc/ceph/ceph.conf
- openstack主机安装相关的软件包
sudo apt-get install python-rbd
sudo apt-get install ceph-common
- 同步keyring文件
# 将dk-cinder user的keyring拷贝到cinder volume节点,并更改相应的权限.
ceph auth get-or-create client.dk-cinder | ssh {your-openstack-server} sudo tee /etc/ceph/ceph.client.dk-cinder.keyring
ssh {your-openstack-server} sudo chown cinder:cinder /etc/ceph/ceph.client.dk-cinder.keyring (devstack环境中不需要设置用户组)
- nova认证dk-cinder
ceph auth get-key client.dk-cinder | ssh {your-compute-node} sudo tee /etc/ceph/client.dk-cinder.key
uuidgen
> 70cafbfb-3f5e-48c5-8acc-32858cb0814d
cat > secret.xml <<EOF
<secret ephemeral='no' private='no'>
<uuid> 70cafbfb-3f5e-48c5-8acc-32858cb0814d</uuid>
<usage type='ceph'>
<name>client.dk-cinder secret</name>
</usage>
</secret>
EOF
sudo virsh secret-define --file secret.xml
sudo virsh secret-set-value --secret 70cafbfb-3f5e-48c5-8acc-32858cb0814d --base64 $(cat client.dk-cinder.key) && rm client.dk-cinder.key secret.xml
- 设置cinder.conf(/etc/cinder/cinder.conf)
backend name (rbd2)可随意设置,保持统一就行
cat cinder.conf
[DEFAULT]
...
enabled_backends = rbd2
...
[rbd2]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rados_connect_timeout = -1
rados_connection_interval = 5
rados_connection_retries = 3
rdb_ceph_conf = /etc/ceph/ceph.conf
rbd_cluster_name = ceph
rbd_flatten_volume_from_snapshot = True
rbd_max_clone_depth = 5
rbd_pool = dk-pool
rbd_user = dk-cinder
rbd_secret_uuid = 70cafbfb-3f5e-48c5-8acc-32858cb0814d
rbd_store_chunk_size = 4
volume_backend_name = rbd2
- 重启cinder服务,查看cinder list
集成验证:
- 创建卷类型
- 设置volume type
- 创建卷
- 查看卷信息
- ceph ls dk-pool
openstack平台环境搭建
部署步骤:
- Add Stack User
$ sudo useradd -s /bin/bash -d /opt/stack -m stack
$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
$ sudo su - stack
- Download DevStack
$ git clone https://git.openstack.org/openstack-dev/devstack
$ cd devstack
- Create a local.conf
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
- Start the install
./stack.sh
依赖问题:
- 依赖及Python库版本问题,根据错误信息修改替换即可
etcd-v3.1.10-linux-amd64.tar.gz 无法自动下载成功,手动从错误处的网址下载,放在/opt/stack/devstack/files 目录中
(如果提示MD5校验失败,手动删除md5记录文件)mysql安装失败: purse autoremove autoclean 后重新安装
配置源:
vi ~/.pip/pip.conf
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
vi /etc/apt/sources.lis
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse