cinder是openstack中提供塊存盤服務的組件,主要是為虛擬機實體提供虛擬磁盤,
通過某種協議(SAS,SCSI,SAN,iSCSI等)掛接裸硬碟,然后磁區、格式化創建的檔案,或者直接使用裸硬碟存盤資料的方式叫做塊存盤,每個裸硬碟通常也叫做Volume(卷),
通過nfs,cifs等協議,需要掛載的遠程檔案系統,叫做檔案系統存盤,
cinder流程
1)用戶 向 API 發送請求
2)api對請求做一些必要的處理后,向messaging(rabbitmq)發送資訊,讓scheduler創建一個volume
3) scheduler從messaging獲取到api發送的訊息,然后執行調度演算法,從若干存盤節點選出節點A
4) scheduler向messaging發送一條訊息,讓存盤節點創建volume
5)存盤節點的volume 從messaging中獲取到scheduler發給它的訊息,然后通過driver在volume provider上創建volume
以下部分在controller節點進行配置
cinder暫時只做了controller節點部分
在安裝和配置Block Storage 服務之前,必須創建資料庫,服務憑證,和API節點并授予合適的權限:
cinder配置
在控制節點上創建資料庫,并授權用戶,參考命令
MariaDB [(none)]> CREATE DATABASE cinder;
為cinder資料庫授權
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \ IDENTIFIED BY 'CINDER_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \ IDENTIFIED BY 'CINDER_DBPASS'; 'CINDER_DBPASS' 設定自己的密碼
取得管理員憑據,以訪問僅管理員的CLI命令:
$ . admin-openrc 這是個腳本檔案,你之前需要添加的所有系統環境變數 沒有可以新建一個
創建一個cinder用戶
$ openstack user create --domain default --password-prompt cinder User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 9d7e33de3e1a498390353819bc7d245d | | name | cinder | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
添加admin角色到用戶cinder中
$ openstack role add --project service --user cinder admin
創建cinderv2和cinderv3服務物體:
$ openstack service create --name cinderv2 \ --description "OpenStack Block Storage" volumev2 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | eb9fd245bdbc414695952e93f29fe3ac | | name | cinderv2 | | type | volumev2 | +-------------+----------------------------------
$ openstack service create --name cinderv3 \ --description "OpenStack Block Storage" volumev3 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | ab3bbbef780845a1a283490d281e7fda | | name | cinderv3 | | type | volumev3 | +-------------+----------------------------------+
Note:
塊存盤服務需要兩個服務物體,
創建塊存盤服務API端點:
$ openstack endpoint create --region RegionOne \ volumev2 public http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 513e73819e14460fb904163f41ef3759 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | eb9fd245bdbc414695952e93f29fe3ac | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+ $ openstack endpoint create --region RegionOne \ volumev2 internal http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 6436a8a23d014cfdb69c586eff146a32 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | eb9fd245bdbc414695952e93f29fe3ac | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+ $ openstack endpoint create --region RegionOne \ volumev2 admin http://controller:8776/v2/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | e652cf84dd334f359ae9b045a2c91d96 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | eb9fd245bdbc414695952e93f29fe3ac | | service_name | cinderv2 | | service_type | volumev2 | | url | http://controller:8776/v2/%(project_id)s | +--------------+------------------------------------------+
volumev3:
$ openstack endpoint create --region RegionOne \ volumev3 public http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 03fa2c90153546c295bf30ca86b1344b | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | ab3bbbef780845a1a283490d281e7fda | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+ $ openstack endpoint create --region RegionOne \ volumev3 internal http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 94f684395d1b41068c70e4ecb11364b2 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | ab3bbbef780845a1a283490d281e7fda | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+ $ openstack endpoint create --region RegionOne \ volumev3 admin http://controller:8776/v3/%\(project_id\)s +--------------+------------------------------------------+ | Field | Value | +--------------+------------------------------------------+ | enabled | True | | id | 4511c28a0f9840c78bacb25f10f62c98 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | ab3bbbef780845a1a283490d281e7fda | | service_name | cinderv3 | | service_type | volumev3 | | url | http://controller:8776/v3/%(project_id)s | +--------------+------------------------------------------+
塊存盤服務需要為每個服務物體創建端點,
安裝與配置
安裝服務包
# yum install openstack-cinder
編輯組態檔/etc/cinder/cinder.conf
在【database】節點,配置資料庫訪問入口
[database] # ... connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder CINDER_DBPASS改為cinder資料庫的密碼
在【DEFAULT】節點,配置RabbitMQ訊息佇列訪問
[DEFAULT] # ... transport_url = rabbit://openstack:RABBIT_PASS@controller openstack:RABBIT_PASS 改為訊息佇列里創建的用戶名和密碼
在[DEFAULT]和[keystone_authtoken]部分中,配置身份服務訪問:
[DEFAULT] # ... auth_strategy = keystone [keystone_authtoken] # ... www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_id = default user_domain_id = default project_name = service username = cinder password = CINDER_PASS //改為cinder的密碼
在[DEFAULT]部分中,配置my_ip選項以使用控制器節點的管理介面IP地址:
[DEFAULT] # ... my_ip = 10.0.0.11 //controller節點IP
在[oslo_concurrency]部分中,配置鎖定路徑:
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
填充資料庫
# su -s /bin/sh -c "cinder-manage db sync" cinder

如果出現上述結果,屬于正常,
配置計算服務以使用塊存盤
編輯/etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
完成安裝
重啟計算服務API
# systemctl restart openstack-nova-api.service
啟動塊存盤服務,并將其配置為在系統啟動時啟動:
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/47575.html
標籤:其他
