天天看點

OpenStack Juno系列之結合ceph

OpenStack Juno系列之結合ceph

1.建立兩個池。

 ceph osd pool create volumes 128

 ceph osd pool create images 128

補充内容:

在glance節點

apt-get install python-ceph

在nova-compute節點和cinder節點

apt-get install ceph-common

2.把ceph配置檔案拷貝到glance節點和cinder-volumes節點

sshX.X.X.X sudo tee /etc/ceph/ceph.conf </etc/ceph/ceph.conf

3.Ceph授權使用者

ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-readobject_prefix rbd_children, allow rwx pool=volumes, allow rx pool=images'

ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-readobject_prefix rbd_children, allow rwx pool=images'

4.把密鑰拷貝到glance節點和cinder-volumes節點、nova-compute 節點

ceph auth get-or-create client.glance | ssh X.X.X.X sudo tee /etc/ceph/ceph.client.glance.keyring

sshX.X..X.X sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring

ceph auth get-or-create client.cinder | ssh X.X.X.X sudo tee/etc/ceph/ceph.client.cinder.keyring

sshX.X.X.X sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring

ceph auth get-key client.cinder | ssh X.X.X.X tee client.cinder.key  這裡是把cinder密鑰拷貝到計算節點

5.配置glance節點,在glance-api配置檔案中修改以下内容

default_store= rbd

stores= glance.store.rbd.Store

rbd_store_ceph_conf= /etc/ceph/ceph.conf

rbd_store_user= glance

rbd_store_pool= images

rbd_store_chunk_size= 8

show_image_direct_url = True

配置完重新開機glance-api服務即可

6.配置cinder-volume節點,添加以下内容

glance_host= XXXXX

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= bfe573d1-0a91-42e8-941a-49d5730c4150

UUID需要自己生成

uuidgen指令

7.配置nova-compute節點

cat> secret.xml <<EOF

  <secret ephemeral='no' private='no'>

 <uuid>bfe573d1-0a91-42e8-941a-49d5730c4150</uuid>

  <usage type='ceph'>

  <name>client.cinder secret</name>

  </usage>

  </secret>

  EOF

sudovirsh secret-define --file secret.xml

sudovirsh secret-set-value --secret bfe573d1-0a91-42e8-941a-49d5730c4150 --base64$(cat client.cinder.key)

編輯nova.conf檔案,添加以下内容

[libvirt]

images_type= rbd

images_rbd_pool= volumes

images_rbd_ceph_conf= /etc/ceph/ceph.conf

libvirt_live_migration_flag="VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST"

配置完成之後重新開機nova-compute服務

8.驗證copy on write功能

1.)上傳一個 raw 鏡像到 glance

2.)cinder create  --image-id <image_id>  10

3.)到ceph節點檢視

rbd lsvolumes -l

類似于以下這個比如出現snap字樣

volume-1147d5ee-5cae-4819-b58e-9eb1723f6c1340960M volumes/e5b6d62f-2876-40e5-a4d8-27d41552a631@snap   2 

補充排錯:

Cinder節點

問題類型:

做RBD的時候出現類似于這種情況一般都是RBD配置有問題

解決方法:

把RBD相關内容放在[DEFAULT]選項中

<a href="http://s3.51cto.com/wyfs02/M02/59/81/wKiom1TUiw_x8afSAAUq8O4lM8o902.jpg" target="_blank"></a>

出現以下情況可能是因為cinder-volumes節點和ceph節點通信有問題導緻驅動無法初始化

<a href="http://s3.51cto.com/wyfs02/M00/59/7D/wKioL1TUi_2AHsHWAAvdmJKHJBg389.jpg" target="_blank"></a>

Nova-compute節點

在nova上配置RBD的時候遇見以下情況,一般都是RBD配置問題。

<a href="http://s3.51cto.com/wyfs02/M00/59/81/wKiom1TUixDSOTCJAAPmHaakUsA234.jpg" target="_blank"></a>

解決方法把RBD相關内容放在[DEFAULT]選項中

libvirt_images_type = rbd

libvirt_images_rbd_pool = volumes

libvirt_images_rbd_ceph_conf = /etc/ceph/ceph.conf

rbd_user = cinder

rbd_secret_uuid = 6badfb2f-7e11-4810-bc11-40a73373259e

本文轉自Devin 51CTO部落格,原文連結:http://blog.51cto.com/devingeng/1610676

繼續閱讀