新闻

NEWS

VC君讲技术09 | rbd一致性组与一致性快照特性

发布时间:2020-10-10 发布者:瑞驰信息技术
功能需求
1、ceph官方新功能预研说明:
http://tracker.ceph.com/projects/ceph/wiki/Consistency_groups/2
传统存储通过支持一致性组来完成对于应用层卷远程复制的支持,因为像 Oracle 这种
应用通常单一卷快照是无法接近应用快照,一个应用跟多个卷相关。OpenStack Cinder 也
实现了对一致性组的 API 支持。
2、关于rbd的一致性组和快照的功能需求在redhat社区有提出来:
https://access.redhat.com/solutions/2763551
需求:协助管理和备份数据库,并连接到OpenStack Cinder。确保Ceph中的RBD驱动程序
处理一致性组


RBD 一致性组

Consistency Group,即一致性组,把一批存在公共操作的卷,在逻辑上划分为一个
组,用户可以很方便的通过操作该组,来操作组中所有的卷,而不需要一个个的去操作这些
卷,主要是出于数据保护和容灾的考虑。在这个 PR 中,开发者实现了 librbd Consistency
Group 的支持,包括为 Consistency Group 打快照的功能。
实现原理:
attaching multiple RBD images to the same journal to ensure consistent replay
不同rbd的image块设备关联到同一个journal从而实现一致性回滚,该功能依赖rbd的
journal特性


RBD 一致性快照

一致性组将成为一个新的 RBD 对象,类似于 RBD Image,Snapshot。一致性快照在
一致性组的基础上实现。它的实现跟目前 RBD 的一些复杂状态机特性是接近的,都是采用
Notify/Watch 机制实现。通过客户端发起对于多个卷的快照,经过所有卷客户端同意并快
照后,保存这几个快照的snapid。如果中间有卷无法成功,则简单删除快照即可。


之前社区L版master对于rbd一致性组功能命令如下:



功能设计说明

对象属性属性
The structure of objects for a consistency group is similar to an image.
1、When consistency groups is created we create an object in the pool called
consistency_group_id.<consistency group name>
This object contains the consistency group's id.
2、Every consistency group will have an object called consistency_group_header.
<consistency group id>
This header will contain the list of images in this consistency group.




API设计说明

This feature will require to add a new entity ­ consistency group.
You should be able to run the following operations on a consistency group:
Create a consistency group
Show a consistency group
List all available consistency groups
Add an image to a consistency group
Create a snapshot of all the members of a consistency group
­ Created snapshot of a consistency group only has references to snapshots that appear
under the corresponding images
List all snapshots of a consistency group
Delete consistency group's snapshot
Modify consistency group (delete, add images to the consistency group)
A consistency group is empty upon its creation. Images need to be created and

added to it later.


命令说明

* rbd consistency-group create <group-spec>

[--object-pool <pool-name>]
[--splay-width <num>]
[--object-size <B/K/M>]
[--additional-journal-tweakable-settings]
This will create an empty journal for use with consistency groups (i.e.
attaching
multiple RBD images to the same journal to ensure consistent replay).


* rbd consistency-group rename <group-spec>

This will remove the named consistency group journal. If one or more images
are attached, this will fail.


* rbd consistency-group attach <image-spec> <journal-spec>

This will enable the RBD journaling feature bit and will configure the image to
record all journal entries to the specified journal. If journaling is already
enabled on the image, this will fail.


* rbd consistency-group detach <image-spec>

This will detach the specified image from its journal and disable the RBD
journaling feature.


* rbd consistency-group ls

This will list all consistency groups within the current pool.


* rbd consistency-group info <group-spec>

This will display information about the specified consistent group
where <group-spec> is [<pool-name>/]<group-name>



一致性组相关pr:

1、rbd: initial operations for consistency groups
https://github.com/ceph/ceph/pull/9333/commits
2、librbd: add consistency groups operations with images
https://github.com/ceph/ceph/pull/10034/commits
3、librbd: extract group module from librbd/internal3、librbd: extract group module from librbd/internal
https://github.com/ceph/ceph/pull/11070/commits
4、librbd: ensure consistency groups will gracefully fail on older OSDs
https://github.com/ceph/ceph/pull/11623
5、librbd: add support for snapshot namespaces

https://github.com/ceph/ceph/pull/11160/commits


一致性快照相关pr:

1、librbd: group snapshots
https://github.com/ceph/ceph/pull/11544/commits
2、rbd: Consistency group snapshot rename
https://github.com/ceph/ceph/pull/12431/commits
3、rbd: group snapshot info
https://github.com/ceph/ceph/pull/12637/commits
4、librbd: group and snapshot cleanup
https://github.com/ceph/ceph/pull/19990/commits
社区关闭一致性组的pr以及删除之前的提交:
5、删除的pr
https://github.com/ceph/ceph/pull/16875
之前提交的pr关闭,合入的pr删除,待后续版本开发上线
重新开启的功能说明:
https://github.com/OpenNebula/one/issues/3143