OpenStack-liberty版Ciner部署(九)

存储的分类:
块存储:
硬盘
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组件:
OpenStack-liberty版Ciner部署(九)
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存储节点:

猜你喜欢

转载自blog.51cto.com/smoke520/2299010