openstack 組件volume,image後端存儲使用ceph

Ceph是一個 Linux PB 級分佈式文件系統

ceph 部署安裝請參考:

Ubuntu 12.04 Ceph分佈式文件系統之概述


Ubuntu 12.04 Ceph分佈式文件系統之部署


一、在ceph中創建一個pool

       默認情況下,Ceph塊設備使用rbd pool。你可以使用任何可用的pool。我們建議創建一個新的pool。確保你的Ceph集羣正在運行,然後創建池。

ceph osd pool create volumes 128
ceph osd pool create p_w_picpaths 128

二、配置 OpenStack Ceph 客戶端

   1、openstack 運行 glance-api, nova-compute, and nova-volume orcinder-volume的服務器需要 ceph.conf配置文件:

ssh {your-openstack-server} sudo tee /etc/ceph/ceph.conf </etc/ceph/ceph.conf


   2、安裝ceph客戶端

sudo apt-get install python-ceph
sudo apt-get install ceph-common


   3、設置Ceph客戶端身份驗證

       (1)對於Ceph版本0.53或更低,執行以下:

ceph auth get-or-create client.volumes mon 'allow r' osd 'allow x, allow rwx pool=volumes, allow rx pool=p_w_picpaths'
ceph auth get-or-create client.p_w_picpaths mon 'allow r' osd 'allow x, allow rwx pool=p_w_picpaths'

       (2)在Ceph 0.54或更高版本,添加了更多的具體權限,執行以下:

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=p_w_picpaths'
ceph auth get-or-create client.p_w_picpaths mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=p_w_picpaths'


        (3)爲客戶端client.volumesclient.p_w_picpaths添加key

ceph auth get-or-create client.p_w_picpaths | ssh {your-glance-api-server} sudo tee /etc/ceph/ceph.client.p_w_picpaths.keyring
ssh {your-glance-api-server} sudo chown glance:glance /etc/ceph/ceph.client.p_w_picpaths.keyring
ceph auth get-or-create client.volumes | ssh {your-volume-server} sudo tee /etc/ceph/ceph.client.volumes.keyring
ssh {your-volume-server} sudo chown cinder:cinder /etc/ceph/ceph.client.volumes.keyring


三、配置openstack 使用ceph

   1、配置glance

   修改 /etc/glance/glance-api.conf 文件配置以下內容:

default_store=rbd
rbd_store_user=p_w_picpaths
rbd_store_pool=p_w_picpaths
show_p_w_picpath_direct_url=True


   2、配置Cinder/nova-volume

       修改 /etc/cinder/cinder.conf 文件配置以下內容:

volume_driver=cinder.volume.driver.RBDDriver
rbd_pool=volumes


   3、重啓openstack相關服務

sudo service glance-api restart
sudo service nova-compute restart
sudo service cinder-volume restart


四、測試

   1、創建volume存儲

cinder create --p_w_picpath-id {id of p_w_picpath} --display-name {name of volume} {size of volume}


   2、上傳鏡像

glance --os_username={TENANT_NAME} --os_password={TENANT_PASS} --os_tenant={TENANT} --os_auth_url={OS_AUTH_URL} add name="{glance_name}" disk_format=aki container_format=aki < {IMAGE_FILE}


五、查看pool

這個環境中glance沒有使用ceph

rados df
pool name       category                 KB      objects       clones     degraded      unfound           rd        rd KB           wr        wr KB
volumes  -                    9618834         2586            0            0           0           20            3        71686     37911743
data            -                          0            0            0            0           0            0            0            0            0
metadata        -                          9           21            0            0           0           11            0           52           26
rbd             -                          0            0            0            0           0            0            0            0            0
  total used        23486608         2607
  total avail      176679288
  total space      200165896


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章