cinder具体功能如下:
1 提供 REST API 使用户能够查询和管理 volume、volume snapshot 以及 volume type
2 提供 scheduler 调度 volume 创建请求,合理优化存储资源的分配
3 通过 driver 架构支持多种 back-end(后端)存储方式,包括 LVM,NFS,Ceph 和其他诸如 EMC、IBM 等商业存储产品和方案
12.1 创建cinder节点使用的lvm磁盘 - compute142
#安装支持软件包
apt install lvm2 thin-provisioning-tools -y
#创建lvm物理卷 - 前提是compute节点有一块未使用磁盘,也可以直接使用单盘,直接从12.2开始
pvcreate /dev/sdb
#输出
Physical volume "/dev/sdb" successfully created.
#创建lvm物理卷组
vgcreate cinder-volumes /dev/sdb
#输出
Volume group "cinder-volumes" successfully created
#配置设备过滤,将硬盘过滤出来
12.2 部署与配置cinder计算节点
#安装支持软件包
apt install cinder-volume -y
#备份cinder配置
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
egrep -v "^$|^#" /etc/cinder/cinder.conf.bak >/etc/cinder/cinder.conf
#配置cinder配置文件,在对应项底下增加以下字段
#vim /etc/cinder/cinder.conf
[DEFAULT]
# ...
my_ip = 172.16.1.162
transport_url = rabbit://rabbitmq:rabbitmq.123@controller160:5672/
enabled_backends = lvm
glance_api_servers = http://controller160:9292
auth_strategy = keystone
[database]
# ...
connection = mysql+pymysql://cinder:cinder.123@controller160/cinder
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller160:5000
auth_url = http://controller160:5000
memcached_servers = controller160:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = cinder.123
[lvm]
# ...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = tgtadm
[oslo_concurrency]
# ...
lock_path = /var/lib/cinder/tmp
#重启cinder-volume服务,并配置开机启动:
systemctl enable tgt cinder-volume
systemctl restart tgt cinder-volume
systemctl status tgt cinder-volume
12.3 cinder服务验证
#加载管理凭证
source adminrc.sh
#执行状态检查,都为up为正常
openstack volume service list
#输出
+------------------+----------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+----------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller160 | nova | enabled | up | 2020-05-22T07:10:29.000000 |
| cinder-volume | compute162@lvm | nova | enabled | up | 2020-05-22T07:10:28.000000 |
+------------------+----------------+------+---------+-------+----------------------------+
#dashboard能够正常创建卷
至此,cinder服务已部署完毕,如有问题请联系我改正,感激不尽!
12.x 部署过程遇到的问题汇总
eg1.执行状态检查时发现报错
root@controller160:~# openstack volume service list
The server is currently unavailable. Please try again at a later time.<br /><br />
The Keystone service is temporarily unavailable.
但是执行其他命令是正常的,因此判断非keystone问题,回顾下安装步骤
root@controller160:~# openstack service list
+----------------------------------+-----------+-----------+
| ID | Name | Type |
+----------------------------------+-----------+-----------+
| 0d9cdd8f207147bf93b573203c8e78a3 | placement | placement |
| 0e20d3c0a35e486bb2aed2bf3cc17c00 | neutron | network |
| 6ad962f2c8834b1cbaac24c5c952bbe7 | glance | image |
| 99b513bed6da45ae814b3d99a10e87e5 | keystone | identity |
| bf7d430353f84346b27d26a3117a52e7 | cinderv3 | volumev3 |
| f1173afb33a741ddb3a6540b3a8e70f6 | cinderv2 | volumev2 |
| fc0fb7e04b4443cd95be23d91bd0fc51 | nova | compute |
+----------------------------------+-----------+-----------+
(HTTP 503)
解决方案:重新授权cinder进admin
root@controller160:~# openstack role add --project service --user cinder admin
root@controller160:~# openstack volume service list
+------------------+----------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+----------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller160 | nova | enabled | up | 2020-05-22T07:10:29.000000 |
| cinder-volume | compute162@lvm | nova | enabled | up | 2020-05-22T07:10:28.000000 |
+------------------+----------------+------+---------+-------+----------------------------+