cinder安裝與配置

cinder是openstack中提供塊存儲服務的組件,主要是爲虛擬機實例提供虛擬磁盤。mysql

 

經過某種協議(SAS,SCSI,SAN,iSCSI等)掛接裸硬盤,而後分區、格式化建立的文件,或者直接使用裸硬盤存儲數據的方式叫作塊存儲,每一個裸硬盤一般也叫作Volume(卷)。算法

經過nfs,cifs等協議,須要掛載的遠程文件系統,叫作文件系統存儲。sql

cinder流程數據庫

 1)用戶 向 API 發送請求
api

    2)api對請求作一些必要的處理後,向messaging(rabbitmq)發送信息,讓scheduler建立一個volumebash

    3) scheduler從messaging獲取到api發送的消息,而後執行調度算法,從若干存儲節點選出節點Adom

    4) scheduler向messaging發送一條消息,讓存儲節點建立volumeide

    5)存儲節點的volume 從messaging中獲取到scheduler發給它的消息,而後經過driver在volume provider上建立volumememcached

如下部分在controller節點進行配置

cinder暫時只作了controller節點部分

 

在安裝和配置Block Storage 服務以前,必須建立數據庫,服務憑證,和API節點並授予合適的權限:

 

cinder配置url

在控制節點上建立數據庫,並受權用戶,參考命令

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
相關文章
相關標籤/搜索