Openstack+Ceph 安装及配置-08.1-Openstack-Yoga Cinder安装-控制节点

Openstack Yoga版本Cinder安装-控制节点

配置数据库

[root@node-1 ~]# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'Cinder123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'Cinder123';

创建用户

[root@node-1 ~]# openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:Cinder123
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 7db4579b9d224b69b730b4cd0acd9551 |
| name | cinder |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+

添加admin角色到cinder用户:

[root@node-1 ~]# openstack role add --project service --user cinder admin

 

创建cinderv2,cinderv3服务实体

[root@node-1 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 3ac74010a6a24ae1a8d8344eb1810989 |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
[root@node-1 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev3
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 61ea466747fc417fad25b9baa51b7bce |
| name | cinderv2 |
| type | volumev3 |
+-------------+----------------------------------+

创建cinder服务的API端点(endpoint)

[root@node-1 ~]# openstack endpoint create --region RegionOne volumev2 public http://node-1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 75dd30327863430d8d6b7b3bdc851895 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3ac74010a6a24ae1a8d8344eb1810989 |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://node-1:8776/v2/%(project_id)s |
+--------------+-------------------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne volumev2 internal http://node-1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 4e7b7af9141c47f3a455f403a79314e6 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3ac74010a6a24ae1a8d8344eb1810989 |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://node-1:8776/v2/%(project_id)s |
+--------------+-------------------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne volumev2 admin http://node-1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | f17631581f404d279ed21194c1a72d7f |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3ac74010a6a24ae1a8d8344eb1810989 |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://node-1:8776/v2/%(project_id)s |
+--------------+-------------------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne volumev3 public http://node-1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | c09e9bea809e416594aa7df40b62dd97 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61ea466747fc417fad25b9baa51b7bce |
| service_name | cinderv2 |
| service_type | volumev3 |
| url | http://node-1:8776/v3/%(project_id)s |
+--------------+-------------------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne volumev3 internal http://node-1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | cc1cf4a92dca43b5bdc13ccc4ee3eb97 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61ea466747fc417fad25b9baa51b7bce |
| service_name | cinderv2 |
| service_type | volumev3 |
| url | http://node-1:8776/v3/%(project_id)s |
+--------------+-------------------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne volumev3 admin http://node-1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | e1c0447a43db4ad7adc4cde79199dfd4 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 61ea466747fc417fad25b9baa51b7bce |
| service_name | cinderv2 |
| service_type | volumev3 |
| url | http://node-1:8776/v3/%(project_id)s |
+--------------+-------------------------------------------+

安装服务

[root@node-1 ~]# yum install openstack-cinder

配置服务

[root@node-1 ~]# cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
[root@node-1 ~]# grep -Ev "^#|^$" /etc/cinder/cinder.conf.bak > /etc/cinder/cinder.conf
[root@node-1 ~]# vim /etc/cinder/cinder.conf
[root@node-1 ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RabbitMQ123@node-1
auth_strategy = keystone
my_ip = 172.16.1.81
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:Cinder123@node-1/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://node-1:5000
auth_url = http://node-1:5000
memcached_servers = node-1:11211,node-2:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = Cinder123
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]

初始化数据库

[root@node-1 ~]# su -s /bin/sh -c "cinder-manage db sync" cinder

配置nova

[root@node-1 ~]# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne

重启nova服务

[root@node-1 ~]# systemctl restart openstack-nova-api.service

启动cinder服务

[root@node-1 ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service → /usr/lib/systemd/system/openstack-cinder-api.service.
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service → /usr/lib/systemd/system/openstack-cinder-scheduler.service.
[root@node-1 ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

 

posted @ 2023-03-24 15:28  苦逼挨踢男  阅读(55)  评论(0编辑  收藏  举报