OpenStack 和 Ceph 集成 已翻译 100%

oschina 投递于 2013/05/20 07:39 (共 4 段, 翻译完成于 05-20)
阅读 6548
收藏 6
0
加载中

也许Ceph最有意思的部分就是同OpenStack的集成了。所以在讨论Ceph RadosGW之前,我将先对这部分进行展示。我假定你在看下面的OpenStack同Ceph的集成指南之前,已经架设成功并让Ceph集群(Bobtail->)和OpenStack(Folsom->)运行了起来。Ceph通过利用libvirt和OpenStack一起使用块设备,其中的libvirt配置了QEMU同librbd的接口。OpenStack中有两个部分同Ceph的块设备进行了集成:

  • 映像(Image): 使用OpenStack Glance对VM的映像进行管理
  • 卷(Volume): OpenStack使用卷来启动VM,它还能向运行中的VM添加额外的卷
fbm
fbm
翻译于 2013/05/20 16:34
1

Ceph 集群

创建卷池和图像池:

rados mkpool volumes
rados mkpool images

增加两个池的复制水平:

ceph osd pool set volumes size 3
ceph osd pool set images size 3

现在,为两个池创建 Ceph 客户端和密钥环:

ceph auth get-or-create client.volumes mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rx pool=images' -o /etc/ceph/client.volumes.keyring
ceph auth get-or-create client.images mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' -o /etc/ceph/client.images.keyring

将上面的密钥环复制到 glance-api并将 cinder-volume 节点和 ceph.conf 文件拷贝到 /etc/ceph/目录下。运行 nova-compute 的主机无需密钥环。替代的,他们讲密钥储存于 libvirt。要创建 libvirt 密钥,你需要来自 client.volumes.keyring 的密钥。你可以通过下面命令取得:

ceph-authtool -p -n client.volumes /etc/ceph/client.volumes.keyring > /etc/ceph/client.volumes

当需要时,拷贝这个密钥到 nova-compute 节点。在设置完成后,你可以删除它。同时,要安装 Ceph 组件,你需要 Ceph 官方库(ubuntu):

wget -q -O - 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | apt-key add -
echo "deb http://ceph.com/debian-cuttlefish/ precise main" >> /etc/apt/sources.list.d/ceph.list

在你拷贝 Ceph 集群的 ceph.conf 到 glance-api,且 cinder-volume 节点更新密钥环路径之后:

[client.volumes]
    keyring = /etc/ceph/client.volumes.keyring
[client.images]
    keyring = /etc/ceph/client.images.keyring
K6F
K6F
翻译于 2013/05/20 10:25
1

Glance

在 glance-api 主机,你需要为 librbd 绑定 Python:

apt-get install -y python-ceph

更新你的 glance-api 配置文件(/etc/glance/glance-api.conf):

default_store = rbd
rbd_store_user = images
rbd_store_pool = images
show_image_direct_url = True

并重启 glance-api 服务:

service glance-api restart

Nova compute

创建临时的 secret.xml 文件:

cat > secret.xml <<EOF
<secret ephemeral='no' private='no'>
  <usage type='ceph'>
    <name>client.volumes secret</name>
  </usage>
</secret>
EOF

从创建的 secret.xml 文件创建密钥:

virsh secret-define --file secret.xml

设定 libvirt 使用上面的密钥:

virsh secret-set-value --secret your_key \
                       --base64 $(cat /path/to/client.volumes)
rm client.volumes secret.xml

将密钥记录下载,以便于使用上面的命令添加节点。你也需要使用这个密钥来配置 cinder。重启 nova-compute:

service nova-compute restart

从Ceph 源更新 librbd 到最新版本。 Ubuntu 所带版本较老,无法工作:

apt-get upgrade librbd
K6F
K6F
翻译于 2013/05/20 10:32
1

Cinder 卷

在 cinder-volume 主机,安装客户端命令行工具:

apt-get install -y ceph-common

更新 cinder 配置 (/etc/cinder/cinder.conf):

#iscsi_helper = tgtadm
#volumes_dir = /var/lib/cinder/volumes
# Folsom
#volume_driver=cinder.volume.driver.RBDDriver
# Grizzly
volume_driver=cinder.volume.drivers.rbd.RBDDriver
rbd_pool=volumes
rbd_user=volumes
# libvirt secret key
rbd_secret_uuid=your_key

在 cinder 启动脚本配置文件(/etc/init/cinder-volume.conf)的“stop on runlevel [!2345]” 之后添加如下代码:

env CEPH_ARGS="--id volumes"

重启 cinder-volume 服务:

service cinder-volume restart

所有完成后,你应该可以储存 glance 图像,创建卷,通过卷将它们附加到运行机器或启动机器上。同时,Ceph 兼容敏捷API,你可以将对象直接横向传递给 Ceph。更多信息将在我说道 RadosGW 时提及。

K6F
K6F
翻译于 2013/05/20 10:39
1
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接。
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。
加载中

评论(0)

返回顶部
顶部