next up previous contents
Next: Cinder 服務啟動 Up: 區塊儲存 Cinder Previous: 認識 Cinder   Contents

Cinder 安裝

  1. 安裝套件
    [root@kvm4 ~]# yum install -y openstack-cinder
    
  2. 使用 cinder 原始設定檔
    [root@kvm4 ~]# cp /usr/share/cinder/cinder-dist.conf /etc/cinder/cinder.conf 
    cp: overwrite `/etc/cinder/cinder.conf'? y
    
  3. 載入管理者環境變數。
    [root@kvm4 ~]# source keystonerc_admin 
    [root@kvm4 ~(keystone_admin)]#
    
  4. 初使化 cinder 資料庫。
    [root@kvm4 ~(keystone_admin)]# openstack-db --init \
    --service cinder --password 123qwe --rootpw 123qwe
    Verified connectivity to MySQL.
    Creating 'cinder' database.
    Updating 'cinder' database password in /etc/cinder/cinder.conf
    Initializing the cinder database, please wait...
    Complete!
    
  5. 產生用戶 cinder。
    [root@kvm4 ~(keystone_admin)]# keystone user-create --name cinder --pass 123qwe
    +----------+----------------------------------+
    | Property |              Value               |
    +----------+----------------------------------+
    |  email   |                                  |
    | enabled  |               True               |
    |    id    | eb9ca7e7be3e42e081c3011810e1ada5 |
    |   name   |              cinder              |
    | tenantId |                                  |
    +----------+----------------------------------+
    
  6. 增加用戶 cinder 在租戶 services 的角色為 admin 前, 注意 role admin, tenant services 都必須存在,否則當然無法成功增加 role,可先使用 keystone role-list, keystone tenant-list 檢查是否存在,尤其是 tenant service 是在第 4 章建立物件儲存 Swift 時新增的,若沒有做 swift,此時就必須先產生。如果不存在,必須產生租戶 services。
    [root@kvm4 ~(keystone_admin)]# keystone tenant-create --name services
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    | description |                                  |
    |   enabled   |               True               |
    |      id     | da7fe21aa92743f9baa51fd4368e6726 |
    |     name    |             services             |
    +-------------+----------------------------------+
    
  7. 增加用戶 cinder 在租戶 services 的角色為 admin。
    [root@kvm4 ~(keystone_admin)]# keystone user-role-add \
    --user cinder --role admin --tenant services
    
  8. 增加 cinder service,並記其 id,以建立此服務的 endpoint。
    [root@kvm4 ~(keystone_admin)]# keystone service-create \
    --name=cinder --type=volume --description="Openstack Block Storage Service"
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    | description | Openstack Block Storage Service  |
    |      id     | 3b211e63665d432ca5c5bf488b0ae6fb |
    |     name    |              cinder              |
    |     type    |              volume              |
    +-------------+----------------------------------+
    
  9. 建立 cinder service 的 endpoint。
    [root@kvm4 ~(keystone_admin)]# keystone endpoint-create \
    --service-id 3b211e63665d432ca5c5bf488b0ae6fb \
    --publicurl 'http://kvm4.deyu.wang:8776/v1/%(tenant_id)s' \
    --adminurl 'http://kvm4.deyu.wang:8776/v1/%(tenant_id)s' \
    --internalurl 'http://kvm4.deyu.wang:8776/v1/%(tenant_id)s'
    +-------------+---------------------------------------------+
    |   Property  |                    Value                    |
    +-------------+---------------------------------------------+
    |   adminurl  | http://kvm4.deyu.wang:8776/v1/%(tenant_id)s |
    |      id     |       b5430f44463b4d99b7760df709c53c59      |
    | internalurl | http://kvm4.deyu.wang:8776/v1/%(tenant_id)s |
    |  publicurl  | http://kvm4.deyu.wang:8776/v1/%(tenant_id)s |
    |    region   |                  regionOne                  |
    |  service_id |       3b211e63665d432ca5c5bf488b0ae6fb      |
    +-------------+---------------------------------------------+
    
  10. 使用 openstack-config 工具設定 ciner.conf。
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    keystone_authtoken admin_tenant_name services
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    keystone_authtoken admin_user cinder
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    keystone_authtoken admin_password 123qwe
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    DEFAULT qpid_username qpidauth
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    DEFAULT qpid_password 123qwe
    [root@kvm4 ~(keystone_admin)]# openstack-config --set /etc/cinder/cinder.conf \
    DEFAULT qpid_protocol ssl
    



2015-12-29