Openstack Queens版本雙節點架構筆記10,Ceph安裝2:
安裝和配置儲存節點
先決條件
在儲存節點上安裝和配置Block Storage服務之前,必須準備儲存裝置。
注意
在控制節點上執行這些步驟(實驗做雙節點沒有做儲存節點,所以儲存節點的安裝在控制節點)。
安裝支援實用程式包:
安裝LVM包:
# yum install lvm2 device-mapper-persistent-data
啟動LVM元資料服務並將其配置為在系統引導時啟動:
# systemctl enable lvm2-lvmetad.service
# systemctl start lvm2-lvmetad.service
建立LVM物理卷/dev/sdb:
# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
建立LVM卷組cinder-volumes:
Block Storage服務在此卷組中建立邏輯卷。
# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created
只有例項才能訪問塊儲存卷。但是,底層作業系統管理與卷關聯的裝置。預設情況下,LVM卷掃描工具會掃描 /dev目錄以查詢包含卷的塊儲存裝置。如果專案在其捲上使用LVM,則掃描工具會檢測這些卷並嘗試對其進行快取,這可能會導致底層作業系統和專案卷出現各種問題。您必須重新配置LVM以僅掃描包含cinder-volumes卷組的裝置。編輯 /etc/lvm/lvm.conf檔案並完成以下操作:
在該devices部分中,新增一個接受/dev/sdb裝置的過濾 器並拒絕所有其他裝置:
devices {
...
filter = [ "a/sdb/", "r/.*/"]
Each item in the filter array begins with a for accept or r for reject and includes a regular expression for the device name. The array must end with r/.*/ to reject any remaining devices. You can use the vgs -vvvv command to test filters.
警告
如果儲存節點在作業系統磁碟上使用LVM,則還必須將關聯的裝置新增到過濾器。例如,如果/dev/sda裝置包含作業系統:
filter = [ "a/sda/", "a/sdb/", "r/.*/"]
同樣,如果計算節點在作業系統磁碟上使用LVM,則還必須修改/etc/lvm/lvm.conf這些節點上的檔案中的過濾器 以僅包括作業系統磁碟。例如,如果/dev/sda 裝置包含作業系統:
filter = [ "a/sda/", "r/.*/"]
安裝和配置元件
安裝包:
# yum install openstack-cinder targetcli python-keystone
編輯/etc/cinder/cinder.conf檔案並完成以下操作:
在該[database]部分中,配置資料庫訪問:
[database]
# ...
connection = mysql+pymysql://cinder:[email protected]/cinder
替換CINDER_DBPASS為您為Block Storage資料庫選擇的密碼。
在該[DEFAULT]部分中,配置RabbitMQ 訊息佇列訪問:
[DEFAULT]
# ...
transport_url = rabbit://openstack:[email protected]
替換RABBIT_PASS為您為openstack帳戶選擇的密碼RabbitMQ。
在[DEFAULT]和[keystone_authtoken]部分中,配置身份服務訪問:
[DEFAULT]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_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_PASS為您cinder在Identity服務中為使用者選擇的密碼 。
注意
註釋掉或刪除該[keystone_authtoken]部分中的任何其他選項 。
在該[DEFAULT]部分中,配置my_ip選項:
[DEFAULT]
# ...
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
替換MANAGEMENT_INTERFACE_IP_ADDRESS為儲存節點上管理網路介面的IP地址,對於示例體系結構中的第一個節點,通常為10.0.0.41 。
在本[lvm]節中,使用LVM驅動程式,cinder-volumes卷組,iSCSI協議和相應的iSCSI服務配置LVM後端。如果該[lvm]部分不存在,請建立它:
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
在該[DEFAULT]部分中,啟用LVM後端:
[DEFAULT]
# ...
enabled_backends = lvm
注意
後端名稱是任意的。例如,本指南使用驅動程式的名稱作為後端的名稱。
在該[DEFAULT]部分中,配置Image服務API的位置:
[DEFAULT]
# ...
在該[oslo_concurrency]部分中,配置鎖定路徑:
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
完成安裝
啟動Block Storage卷服務(包括其依賴項)並將其配置為在系統引導時啟動:
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
安裝和配置控制器節點
本節介紹如何在控制器節點上安裝和配置代號為cinder的塊儲存服務。此服務至少需要一個為例項提供卷的附加儲存節點。
先決條件
在安裝和配置Block Storage服務之前,必須建立資料庫,服務憑據和API端點。
要建立資料庫,請完成以下步驟:
使用資料庫訪問客戶端以root使用者身份連線到資料庫伺服器:
$ mysql -u root -p
建立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為合適的密碼。
退出資料庫訪問客戶端。
來源admin憑據來訪問僅管理員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 |
+---------------------+----------------------------------+
Add the admin role to the cinder user:
$ 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 |
+-------------+----------------------------------+
建立Block Storage服務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 |
+--------------+------------------------------------------+
$ 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:[email protected]/cinder
替換CINDER_DBPASS為您為Block Storage資料庫選擇的密碼。
在該[DEFAULT]部分中,配置RabbitMQ 訊息佇列訪問:
[DEFAULT]
# ...
transport_url = rabbit://openstack:[email protected]
替換RABBIT_PASS為您為openstack帳戶選擇的密碼 RabbitMQ。
在[DEFAULT]和[keystone_authtoken]部分中,配置身份服務訪問:
[DEFAULT]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_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_PASS為您cinder在Identity服務中為使用者選擇的密碼。
注意
註釋掉或刪除該[keystone_authtoken]部分中的任何其他選項 。
在該[DEFAULT]部分中,配置my_ip選項以使用控制器節點的管理介面IP地址:
[DEFAULT]
# ...
my_ip = 10.0.0.11
在該[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
完成安裝
重新啟動Compute API服務
# systemctl restart openstack-nova-api.service
啟動Block Storage服務並將其配置為在系統引導時啟動:
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
驗證Cinder操作
驗證塊儲存服務的操作。
注意
在控制器節點上執行這些命令。
來源admin憑據來訪問僅管理員CLI命令:
$ . admin-openrc
列出服務元件以驗證每個程序的成功啟動:
$ openstack volume service list
+------------------+------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated_at |
+------------------+------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2016-09-30T02:27:41.000000 |
| cinder-volume | [email protected] | nova | enabled | up | 2016-09-30T02:27:46.000000 |
+------------------+------------+------+---------+-------+----------------------------+
([email protected]節點down沒關係。)