1. 程式人生 > >OpenStack-liberty版Ciner部署(九)

OpenStack-liberty版Ciner部署(九)

key ner rec put nas pre acl conf commands

存儲的分類:
塊存儲:
硬盤
LVM
DAS(Direct Attach Storage)
是直接連接於主機服務器的一種存儲方式,每一臺主機服務器有獨立的存儲設備,每臺主機服務器的存儲設備無法互通。
通常用單一網絡環境下且數據交換量不大,性能要求不高的環境下,可以說是一種應用較早的技術實現
SAN
1、FC-SAN
2、IP-SAN
分布式存儲-Ceph
Ceph是開源實現的PB級別的分布式文件系統,其分布式對象存儲機制為上層提供了文件接口、塊存儲接口和對象存儲接口
DAS(Direct Attach Storage)
文件存儲:
FS
對象存儲:
SAN(storage Area Network)
NAS

Cinder組件:

技術分享圖片
chnder-api。接受API請求並將請求路由到cinder-volume來執行。
cinder-volume。相應請求,讀取或寫向塊存儲數據庫為維護狀態,通過信息隊列機制與其他進程交互(如cinder-scheduler),或直接與上層塊存儲提供的硬件或軟件進行交互。通過驅動結構,他可以與眾多的存儲提供者進行交互。
cinder-scheduler。守護進程。類型於nova-scheduler,為存儲卷的實例選取最優的塊存儲供應節點。

沒有Cinder時候虛擬機磁盤存放位置;

[root@hostname linux-node2 ~]# ls /var/lib/nova/instances/
_base  compute_nodes  e7585ece-c8e9-4ad8-8796-8a58bca459bf  locks  snapshots
[root@hostname linux-node2 ~]# ls /var/lib/nova/instances/e7585ece-c8e9-4ad8-8796-8a58bca459bf/
console.log  disk  disk.info  libvirt.xml

安裝Cinder控制節點:
[root@hostnamelinux-node1 ~]# yum -y install openstack-cinder python-cinderclient

查看是否已創建cinder數據庫,我這裏在keystone安裝時候已經創建;

[root@hostnamelinux-node1 ~]# mysql -uroot -psmoke520
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 264
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| cinder             |
| glance             |
| information_schema |
| keystone           |
| mysql              |
| neutron            |
| nova               |
| performance_schema |
+--------------------+
8 rows in set (1.25 sec)

MariaDB [(none)]> exit;
Bye

配置Cinder:

[root@hostnamelinux-node1 ~]# vim /etc/cinder/cinder.conf 
[database]
connection = mysql://cinder:[email protected]/cinder

同步數據庫:
[root@hostnamelinux-node1 ~]# su -s /bin/sh -c "cinder-manage db sync" cinder

[root@hostnamelinux-node1 ~]# mysql -ucinder -pcinder -h192.168.56.11 -e "use cinder;show tables;"
+----------------------------+
| Tables_in_cinder           |
+----------------------------+
| backups                    |
| cgsnapshots                |
| consistencygroups          |
| driver_initiator_data      |
| encryption                 |
| image_volume_cache_entries |
| iscsi_targets              |
| migrate_version            |
| quality_of_service_specs   |
| quota_classes              |
| quota_usages               |
| quotas                     |
| reservations               |
| services                   |
| snapshot_metadata          |
| snapshots                  |
| transfers                  |
| volume_admin_metadata      |
| volume_attachment          |
| volume_glance_metadata     |
| volume_metadata            |
| volume_type_extra_specs    |
| volume_type_projects       |
| volume_types               |
| volumes                    |
+----------------------------+

創建用戶:
[root@hostnamelinux-node1 ~]# source admin-openrc.sh

用戶名cinder,密碼cinder;

[root@hostnamelinux-node1 ~]# openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | 5ffa5acdd3d8438e994a6fcd9319708a |
| name      | cinder                           |
+-----------+----------------------------------+

將cinder用戶加入service項目並賦予admin角色;
[root@hostnamelinux-node1 ~]# openstack role add --project service --user cinder admin

更改chinder配置文件:

[root@hostnamelinux-node1 ~]# vim /etc/cinder/cinder.conf 
[DEFAULT]
auth_strategy = keystone
rpc_backend = rabbit
glance_host = 192.168.56.11
[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
[oslo_messaging_rabbit]
rabbit_host = 192.168.56.11
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = openstack
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[root@hostnamelinux-node1 ~]# grep ‘^[a-z]‘ /etc/cinder/cinder.conf 
glance_host = 192.168.56.11
auth_strategy = keystone
rpc_backend = rabbit
connection = mysql://cinder:[email protected]/cinder
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder 
lock_path = /var/lib/cinder/tmp
rabbit_host = 192.168.56.11
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = openstack
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf 
[cinder]
os_region_name = RegionOne

重啟服務:

[root@hostnamelinux-node1 ~]# systemctl restart openstack-nova-api.service
[root@hostnamelinux-node1 ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service to /usr/lib/systemd/system/openstack-cinder-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service to /usr/lib/systemd/system/openstack-cinder-scheduler.service.
[root@hostnamelinux-node1 ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

註冊Cinder:
創建Cinder v1服務:

[root@hostnamelinux-node1 ~]# openstack service create --name cinder --description "OpenStack Block Storage" volume
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 44c68286553947049187cd9886a85807 |
| name        | cinder                           |
| type        | volume                           |
+-------------+----------------------------------+

創建Cinder v2服務:

[root@hostnamelinux-node1 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 9bc7d84ec806418d9046635275518741 |
| name        | cinderv2                         |
| type        | volumev2                         |
+-------------+----------------------------------+

創建v1 endpoint:
公網註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne >  volume public http://192.168.56.11:8776/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 22d5172503014abc99e1448e8990fe01           |
| interface    | public                                     |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 44c68286553947049187cd9886a85807           |
| service_name | cinder                                     |
| service_type | volume                                     |
| url          | http://192.168.56.11:8776/v1/%(tenant_id)s |
+--------------+--------------------------------------------+

私網註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne  volume internal http://192.168.56.11:8776/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 184ede7d6cb64e52a14e884cd90b8455           |
| interface    | internal                                   |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 44c68286553947049187cd9886a85807           |
| service_name | cinder                                     |
| service_type | volume                                     |
| url          | http://192.168.56.11:8776/v1/%(tenant_id)s |
+--------------+--------------------------------------------+

admin註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne  volume admin http://192.168.56.11:8776/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 38796e145c55401e8140815af281d0fd           |
| interface    | admin                                      |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 44c68286553947049187cd9886a85807           |
| service_name | cinder                                     |
| service_type | volume                                     |
| url          | http://192.168.56.11:8776/v1/%(tenant_id)s |
+--------------+--------------------------------------------+

創建v2 endpoint:
公網註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne  volumev2 public http://192.168.56.11:8776/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | c7246b6f7c8d4227b2cb0b03c7ffe694           |
| interface    | public                                     |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 9bc7d84ec806418d9046635275518741           |
| service_name | cinderv2                                   |
| service_type | volumev2                                   |
| url          | http://192.168.56.11:8776/v2/%(tenant_id)s |
+--------------+--------------------------------------------+

私網註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne  volumev2 internal http://192.168.56.11:8776/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | e738d99d2a7a46e5a122ed6b006de63e           |
| interface    | internal                                   |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 9bc7d84ec806418d9046635275518741           |
| service_name | cinderv2                                   |
| service_type | volumev2                                   |
| url          | http://192.168.56.11:8776/v2/%(tenant_id)s |
+--------------+--------------------------------------------+

admin註冊:

[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne  volumev2 admin http://192.168.56.11:8776/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | c7c6845176214a64ab9abefb7cc7acf8           |
| interface    | admin                                      |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 9bc7d84ec806418d9046635275518741           |
| service_name | cinderv2                                   |
| service_type | volumev2                                   |
| url          | http://192.168.56.11:8776/v2/%(tenant_id)s |
+--------------+--------------------------------------------+

安裝Cinder存儲節點:

OpenStack-liberty版Ciner部署(九)