OpenStack 之 Cinder 对象存储安装
配置数据库
MariaDB [(none)]> CREATE DATABASE cinder;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
-> IDENTIFIED BY 'cinder';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
Query OK, 0 rows affected (0.00 sec)
安装软件包
[root@openstack ~]# yum install openstack-cinder
配置 Cinder
编辑 /etc/cinder/cinder.conf 文件,完成如下配置:
在 [database] 块下,配置数据库连接
[database]
# ...
connection = mysql+pymysql://cinder:cinder@192.168.1.140/cinder
在 [DEFAULT] 下,配置 RabbitMQ 消息队列连接
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@192.168.1.140
在 [DEFAULT] 和 [keystone_authtoken] 下,配置认证服务连接
[DEFAULT]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_uri = http:/192.168.1.140:5000
auth_url = http://192.168.1.140:5000
memcached_servers = 192.168.1.140:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
在 [DEFAULT] 下,配置 my_ip 选项,写入控制节点的管理端口 IP
[DEFAULT]
# ...
my_ip = 192.168.1.140
在 [oslo_concurrency] 块,配置 lock 路径
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
同步数据库
[root@openstack ~]# su -s /bin/sh -c "cinder-manage db sync" cinder
验证数据库是否同步成功
[root@openstack ~]# mysql -h 192.168.1.140 -u cinder -pcinder -e "USE cinder;SHOW TABLES;"
+----------------------------+
| Tables_in_cinder |
+----------------------------+
| attachment_specs |
| backup_metadata |
| backups |
| cgsnapshots |
| clusters |
| consistencygroups |
| driver_initiator_data |
| encryption |
| group_snapshots |
| group_type_projects |
| group_type_specs |
| group_types |
| group_volume_type_mapping |
| groups |
| image_volume_cache_entries |
| messages |
| 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 |
| workers |
+----------------------------+
使用对象存储配置计算服务
编辑 /etc/nova/nova.conf 文件,添加如下信息
[cinder]
os_region_name = RegionOne
完成安装
[root@openstack ~]# systemctl restart openstack-nova-api.service
[root@openstack ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
[root@openstack ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
创建 keystone 认证
创建 cinder 用户
[root@openstack ~]# openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | bc859ca3ba4d40bf95650be49e4a7626 |
| name | cinder |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
添加 cinder 用户至 admin 角色
[root@openstack ~]# openstack role add --project service --user cinder admin
创建 cinderv2 和 cinder3 服务入口
[root@openstack ~]# openstack service create --name cinderv2 \
> --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 225c7167fd084f239022952034765e9d |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
[root@openstack ~]# openstack service create --name cinderv3 \
> --description "OpenStack Block Storage" volumev3
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 2a8b53b90b4c450a87f2c131a8f637ac |
| name | cinderv3 |
| type | volumev3 |
+-------------+----------------------------------+
创建 对象存储接口 endpoints
[root@openstack ~]# openstack endpoint create --region RegionOne \
> volumev2 public http://192.168.1.140:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | dd23ef7039d2478bb847879610b27822 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 225c7167fd084f239022952034765e9d |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://192.168.1.140:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+
[root@openstack ~]# openstack endpoint create --region RegionOne volumev2 internal http://192.168.1.140:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 8abda76f38634c0cb55c970d82f26992 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 225c7167fd084f239022952034765e9d |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://192.168.1.140:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+
[root@openstack ~]# openstack endpoint create --region RegionOne volumev2 admin http://192.168.1.140:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 0fb9379e691348bb9c6944b90f9fbcc6 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 225c7167fd084f239022952034765e9d |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://192.168.1.140:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+
[root@openstack ~]# openstack endpoint create --region RegionOne \
> volumev3 public http://192.168.1.140:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 1170ccf38e874fcebfa8cbbd63bc3a0b |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2a8b53b90b4c450a87f2c131a8f637ac |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://192.168.1.140:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+
[root@openstack ~]# openstack endpoint create --region RegionOne volumev3 internal http://192.168.1.140:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | 373f83cb0e9d461793c5c25698aacce7 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2a8b53b90b4c450a87f2c131a8f637ac |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://192.168.1.140:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+
[root@openstack ~]# openstack endpoint create --region RegionOne volumev3 admin http://192.168.1.140:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| enabled | True |
| id | c869bc0f30e24528b8a907bb155498c1 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 2a8b53b90b4c450a87f2c131a8f637ac |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://192.168.1.140:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

浙公网安备 33010602011771号