A, cinder description:
-
Attached via a protocol (SAS, SCSI, SAN, iSCSI, etc.) bare hard disk, and then partition, format, creating a file system; or directly using raw data stored in a hard disk (database)
-
By NFS, CIFS and other protocols, mount remote file systems
-
Provide REST API enables users to query and manage volume, volume snapshot and volume type
-
Provide scheduler scheduling request to create a volume, optimize allocation of storage resources
-
By driver architecture supports a variety of back-end (back-end) storage, including LVM, NFS, Ceph and others, such as EMC, IBM and other commercial storage products and solutions
The client can send the request to the specified address endponits, the request operation cinder-api. Of course, as an end user, we will not send Rest API requests directly. OpenStack CLI, Dashboard and other components need to exchange with Cinder will use these API.
cinder-api which requests to accept it? Simply put, as long as the relevant Volume lifecycle operations, cinder-api can respond. Most operations can be seen on the Dashboard.
通过 Driver 架构支持多种 Volume Provider
接着的问题是:现在市面上有这么多块存储产品和方案(volume provider),cinder-volume 如何与它们配合呢?
通过的 Driver 架构。 cinder-volume 为这些 volume provider 定义了统一的接口,volume provider 只需要实现这些接口,就可以 Driver 的形式即插即用到 OpenStack 系统中。
定期向 OpenStack 报告计算节点的状态
cinder-volume 会定期向 Cinder 报告存储节点的空闲容量来做筛选启动volume
实现 volume 生命周期管理
Cinder 对 volume 的生命周期的管理最终都是通过 cinder-volume 完成的,包括 volume 的 create、extend、attach、snapshot、delete 等。
二、 Cinder 的设计思想
-
客户(可以是 OpenStack 最终用户,也可以是其他程序)向 API(cinder-api)发送请求:“帮我创建一个 volume”
-
API 对请求做一些必要处理后,向 Messaging(RabbitMQ)发送了一条消息:“让 Scheduler 创建一个 volume”
-
Scheduler(cinder-scheduler)从 Messaging 获取到 API 发给它的消息,然后执行调度算法,从若干计存储点中选出节点 A
-
Scheduler 向 Messaging 发送了一条消息:“让存储节点 A 创建这个 volume”
-
存储节点 A 的 Volume(cinder-volume)从 Messaging 中获取到 Scheduler 发给它的消息,然后通过 driver 在 volume provider 上创建 volume。
-
对外提供统一接口,隐藏实现细节
-
API 提供 REST 标准调用服务,便于与第三方系统集成
-
可以通过运行多个 API 服务实例轻松实现 API 的高可用,比如运行多个 cinder-api 进程
三、cinder部署
controller节点
点击Block Storage service——Install and configure controller
1)创建cinder数据库并授权
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
openstack user create --domain default --password-prompt cinder
3)给cinder用户授予管理员权限
openstack role add --project service --user cinder admin
4)创建cinderv2和cinderv3服务
openstack service create --name cinderv2 \ --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 \ --description "OpenStack Block Storage" volumev3
5)再分别创建cinderv2和cinderv3的服务端点
openstack endpoint create --region RegionOne \ volumev2 public http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 internal http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 admin http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 public http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 internal http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 admin http://controller:8776/v3/%\(project_id\)s
6)下载openstack-cinder安装
yum install openstack-cinder
7)编辑cinder配置文件
[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.253.135 #本机ip
8)同步数据库
su -s /bin/sh -c "cinder-manage db sync" cinder
9)编辑nova数据库,取消下面注释
[cinder]
os_region_name = RegionOne
10)重启相关服务
systemctl restart openstack-nova-api.service
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service # systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
11)查看是否部署成功
openstack volume service list
| Binary | Host | Zone | Status | State | Updated At | +------------------+-------------+------+---------+-------+----------------------------+ | cinder-scheduler | controller | nova | enabled | up | 2019-06-06T08:59:35.000000 | +------------------+-------------+------+---------+-------+----------------------------
storage节点
点进Install and configure a storage node
1)安装lvm安装包
openstack-cinder targetcli python-keystone lvm2
2)创建物理卷/卷组和逻辑卷
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
3)编辑配置文件/etc/lvm/lvm.conf(315行后面添加,注意不要超出大括号)
devices { ... filter = [ "a/sdb/", "r/.*/"]
4) Configuration cinder configuration file, the following is required to modify the place
vim /etc/lvm/lvm.conf
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
5) Restart lvm and cinder services
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
6) control nodes to see if the successful deployment
openstack volume service list