一、
二、
三、安装和配置cinder服务(Block Storage service)
(一)在控制节点配置
1、创建cinder数据库及用户
[root@ren3 ~]# mysql -uroot -proot MariaDB [(none)]> create database 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';
2、创建cinder服务
(1)创建cinder用户
[root@ren3 ~]# source openrc [root@ren3 ~]# openstack user create --domain default --password=cinder cinder +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 4f001caf100b4a43a4e2ffd19b2be3cb | | name | cinder | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ [root@ren3 ~]# openstack role add --project service --user cinder admin
(2)创建cinderv2和cinderv3服务实体
[root@ren3 ~]# openstack service create --name cinderv2 \ --description "OpenStack Block Storage" volumev2 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | 6c80f053d1094573b070297b9e47eba6 | | name | cinderv2 | | type | volumev2 | +-------------+----------------------------------+ [root@ren3 ~]# openstack service create --name cinderv3 \ --description "OpenStack Block Storage" volumev3 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | d9213d7647cc4c439acd9b853987b447 | | name | cinderv3 | | type | volumev3 | +-------------+----------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne \ volumev2 public http://ren3:8776/v2/%\(project_id\)s +--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | 6975a94262df4fa59d2beb4f14c1b621 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 6c80f053d1094573b070297b9e47eba6 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://ren3:8776/v2/%(project_id)s | +--------------+------------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne \ volumev2 internal http://ren3:8776/v2/%\(project_id\)s +--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | 144a96b2909745439df20c8e9f946e0f | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 6c80f053d1094573b070297b9e47eba6 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://ren3:8776/v2/%(project_id)s | +--------------+------------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne \ volumev2 admin http://ren3:8776/v2/%\(project_id\)s +--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | 110131cbac834526ae3672df2304dbd3 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 6c80f053d1094573b070297b9e47eba6 | | service_name | cinderv2 | | service_type | volumev2 | | url | http://ren3:8776/v2/%(project_id)s | +--------------+------------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne \ volumev3 public http://ren3:8776/v3/%\(project_id\)s +--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | f387fd612aa044f3804f02671ccd74f0 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | d9213d7647cc4c439acd9b853987b447 | | service_name | cinderv3 | | service_type | volumev3 | | url | http://ren3:8776/v3/%(project_id)s | +--------------+------------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne volumev3 internal http://ren3:8776/v3/%\(project_id\)s +--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | 73706ddbf52d4694862b0a3412f0a7d7 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | d9213d7647cc4c439acd9b853987b447 | | service_name | cinderv3 | | service_type | volumev3 | | url | http://ren3:8776/v3/%(project_id)s | +--------------+------------------------------------+ [root@ren3 ~]# openstack endpoint create --region RegionOne \ volumev3 admin http://ren3:8776/v3/%\(project_id\)s opens+--------------+------------------------------------+ | Field | Value | +--------------+------------------------------------+ | enabled | True | | id | aff11bcd255f4f28b0778a6f3b8b0e93 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | d9213d7647cc4c439acd9b853987b447 | | service_name | cinderv3 | | service_type | volumev3 | | url | http://ren3:8776/v3/%(project_id)s | +--------------+------------------------------------+ t[root@ren3 ~]# openstack endpoint list |grep volume | 110131cbac834526ae3672df2304dbd3 | RegionOne | cinderv2 | volumev2 | True | admin | http://ren3:8776/v2/%(project_id)s | | 144a96b2909745439df20c8e9f946e0f | RegionOne | cinderv2 | volumev2 | True | internal | http://ren3:8776/v2/%(project_id)s | | 6975a94262df4fa59d2beb4f14c1b621 | RegionOne | cinderv2 | volumev2 | True | public | http://ren3:8776/v2/%(project_id)s | | 73706ddbf52d4694862b0a3412f0a7d7 | RegionOne | cinderv3 | volumev3 | True | internal | http://ren3:8776/v3/%(project_id)s | | aff11bcd255f4f28b0778a6f3b8b0e93 | RegionOne | cinderv3 | volumev3 | True | admin | http://ren3:8776/v3/%(project_id)s | | f387fd612aa044f3804f02671ccd74f0 | RegionOne | cinderv3 | volumev3 | True | public | http://ren3:8776/v3/%(project_id)s |
3、安装软件包
[root@ren3 ~]# yum install openstack-cinder -y
4、修改cinder配置文件(/etc/cinder/cinder.conf)
[DEFAULT] my_ip = 192.168.11.3 #glance_api_servers = http://ren3:9292 auth_strategy = keystone #enabled_backends = lvm transport_url = rabbit://openstack:admin@ren3 [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:CINDER_DBPASS@ren3/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken] auth_uri = http://ren3:5000 auth_url = http://ren3:35357 memcached_servers = ren3:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [matchmaker_redis] [oslo_concurrency] lock_path = /var/lib/cinder/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [oslo_reports] [oslo_versionedobjects] [profiler] [ssl] [lvm] #volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver #volume_group = cinder-vg #volumes_dir = $state_path/volumes #iscsi_protocol = iscsi #iscsi_helper = lioadm #iscsi_ip_address = 192.168.11.5
5、同步数据库
[root@ren3 cinder]# su -s /bin/sh -c "cinder-manage db sync" cinder
6、配置Compute以使用块存储(/etc/nova/nova.conf)
[cinder]
os_region_name = RegionOne
7、启动服务
[root@ren3 cinder]# systemctl restart openstack-nova-api.service [root@ren3 cinder]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service [root@ren3 cinder]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
[root@ren3 cinder]# openstack volume service list +------------------+------+------+---------+-------+-------------------+ | Binary | Host | Zone | Status | State | Updated At | +------------------+------+------+---------+-------+-------------------+ | cinder-scheduler | ren3 | nova | enabled | up | 2019-10-14T13:06: | | | | | | | 44.000000 | +------------------+------+------+---------+-------+-------------------+
8、开启计算节点cinder服务(/etc/nova/nova.conf)
[cinder]
os_region_name = RegionOne
(二)在存储节点配置
1、准备阶段,安装lvm,创建lvm卷
(1)添加一块磁盘
[root@ren5 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP] sdb 8:16 0 20G 0 disk sr0 11:0 1 4.3G 0 rom
(2)安装lvm
[root@ren5 ~]# yum install lvm2 -y
[root@ren5 ~]# systemctl enable lvm2-lvmetad.service
[root@ren5 ~]# systemctl start lvm2-lvmetad.service
(3)创建lvm
[root@ren5 ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created. [root@ren5 ~]# vgcreate cinder-volumes /dev/sdb Volume group "cinder-volumes" successfully created
2、安装软件包
[root@ren5 ~]# yum install openstack-cinder targetcli python-keystone -y
3、修改cinder配置文件(/etc/cinder/cinder.conf)
[DEFAULT] my_ip = 192.168.11.5 glance_api_servers = http://ren3:9292 auth_strategy = keystone enabled_backends = lvm transport_url = rabbit://openstack:admin@ren3 [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:CINDER_DBPASS@ren3/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken] auth_uri = http://ren3:5000 auth_url = http://ren3:35357 memcached_servers = ren3:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [matchmaker_redis] [oslo_concurrency] lock_path = /var/lib/cinder/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [oslo_reports] [oslo_versionedobjects] [profiler] [ssl] [lvm] volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_group = cinder-volumes volumes_dir = $state_path/volumes iscsi_protocol = iscsi iscsi_helper = lioadm iscsi_ip_address = 192.168.11.5
4、启动服务
[root@ren5 cinder]# systemctl enable openstack-cinder-volume.service target.service [root@ren5 cinder]# systemctl start openstack-cinder-volume.service target.service
5、验证(在控制节点)
[root@ren3 cinder]# openstack volume service list +----------------+----------+------+---------+-------+-----------------+ | Binary | Host | Zone | Status | State | Updated At | +----------------+----------+------+---------+-------+-----------------+ | cinder- | ren3 | nova | enabled | up | 2019-10-14T13:3 | | scheduler | | | | | 7:55.000000 | | cinder-volume | ren5@lvm | nova | enabled | up | 2019-10-14T13:3 | | | | | | | 7:48.000000 | +----------------+----------+------+---------+-------+-----------------+