本篇为 2019 年度《Ceph 开发者月报》专栏的开年第一篇,在此先预祝各位读者朋友们新春快乐,心想事成。Ceph社区在2018年依然保持着十分活跃的社区参与度,各个模块不断推陈出新,如果你对Ceph的最新开发进展感兴趣,而又对查阅一个个commit感到烦恼,那么不妨抽出10分钟,看看《Ceph开发者月报》给你带来的当月精华。UMCloud 存储团队将以月度为单位,为大家分享当月 Ceph 社区的有趣的提交和重要的变更,方便大家即刻掌握一手 Ceph 社区开发资料。每篇将以对象存储、块存储、统一存储层、集群管理、基础库等模块组织,为大家一一介绍。
- 对象存储
- 块存储
- 统一存储层
- 集群管理
- 基础工具集
- 本月提交情况
本期看点:
storage class功能终于在对象存储中得以实现,数据分级不再困扰着我们了:
rgw: rados tiering by yehudasa · Pull Request #25774 · ceph/ceph
对象存储
1. storage class is coming
rgw: rados tiering
https://github.com/ceph/ceph/pull/25774
在上面的 PR 中实现了 storage class。对于不同案例场景和性能访问需求,使用不同的存储分级对数据的存储方案进行合理化配置,可以在保证数据访问性能的同时对数据的存储成本进行最大程度的规约,让数据的分布更加灵活可控。
添加 storage class:
# radosgw-admin zonegroup placement add --rgw-zone default --placement-id default-placement --storage-class {storage_class}
# radosgw-admin zone placement add --rgw-zone default --placement-id default-placement --storage-class {storage_class} --data-pool default.rgw.buckets.data.{storage_class}
一些实现细节:
- 我们都知道RGW下一个对象由两部分组成:head object + tail object。每一个存储桶具有默认 storage class,该storage class 采用default.rgw.buckets.data这个存储池来存放所有对象的 head object,并且在默认情况下,tail object也存放在default.rgw.buckets.data这个存储池中。storage class的出现可以让用户自定义指向一个存储池,将tail object 存放这个存储池中。
- 每个 placement target 都有 storage class
- storage class 在 zonegroup 配置中定义,zone info 定义 storage class 到 rados pools 之间的映射
本次实现还支持对象从一个 storage class 转移到另一个 storage class 的配置,完善了对象生命周期管理功能。
生命周期配置是一组规则,用于定义 S3 对一组对象应用的操作。有两种类型的操作:
- expiration: 定义对象的过期时间
- transition: 定义对象转移到另一个 storage class 的时间
此前 Ceph RGW 仅支持到期删除(即 expiration)的生命周期管理 (http://docs.ceph.com/docs/master/radosgw/s3/#features-support)
2. RGW 加密添加 openssl 支持
crypto: add openssl support for RGW encryption
(https://github.com/ceph/ceph/pull/15168)
块存储
librbd: 添加 trash purge API 用于批量删除垃圾站里过期 RBD 镜像
librbd: add trash purge api calls
(https://github.com/ceph/ceph/pull/24427)
统一存储层
1. Crimson OSD 驱动的实现
crimson/osd: crimson osd driver
(https://github.com/ceph/ceph/pull/25304)
Crimson 是一个基于 Seastar 的高效 OSD 设计原型,此次实现了 Crimson OSD 驱动。
关于 crimson 的开发进度可以在这里找到:Ceph Projects - Crimson (https://github.com/ceph/ceph/projects/2)
2. BlueStore 实现 BlueFS 按需请求空间分配,而非依赖于后台周期性的 rebalance
os/bluestore: implement on-demand BlueFS space allocation at slow dev
(https://github.com/ceph/ceph/pull/25132)
BlueStore 此前是周期性地 rebalance free space,在高负载和 DB volume 满的情况下(元数据溢出到 primary device),即使块设备上还有空间,BlueStore 也可能无法分配空间给 BlueFS。
此次实现 BlueFS 按需请求空间解决了这一问题。
3. OSD 可提供 NUMA 信息
osd: report numa information for network and storage; attempt to set affinity magically
(https://github.com/ceph/ceph/pull/25792)
NUMA (非一致内存访问,Non-Uniform Memory Access) 技术将多个 CPU 划分为不同的 NUMA 节点。在物理分布上,每个 NUMA 节点的处理器和内存块的物理距离更小,访问它自己的本地内存比非本地内存的速度更快。对于进程来说如果让其运行在已经分配内存的 NUMA 节点上,那么其访问效率可以最大化。
上面的 PR 提供以下配置:
- osd_numa_node: 用于手动绑定 OSD 和 NUMA 节点
- osd_numa_auto_affinity: 如果网络和存储在同一 NUMA 节点上会自动设置 affinity
- osd_numa_prefer_iface: OSD 选择 IP 时会尽量选同一 NUMA 节点上的
- ceph osd numa-status 命令显示所有 OSD 的 NUMA 信息
配置示例:
# bin/ceph osd numa-status
OSD HOST NETWORK STORAGE AFFINITY CPUS
0 gnit 0 1 - -
1 gnit 0 1 - -
2 gnit 0 1 - -
# bin/ceph config set osd.0 osd_numa_node 0
# bin/ceph config set osd.1 osd_numa_node 1
# bin/ceph osd down 0 1
marked down osd.0. marked down osd.1.
# bin/ceph osd numa-status
OSD HOST NETWORK STORAGE AFFINITY CPUS
0 gnit 0 1 0 0-7,16-23
1 gnit 0 1 1 8-15,24-31
2 gnit 0 1 - -
# taskset -pc `cat out/osd.0.pid`
pid 31315's current affinity list: 0-7,16-23
# taskset -pc `cat out/osd.1.pid`
pid 31644's current affinity list: 8-15,24-31
# taskset -pc `cat out/osd.2.pid`
pid 31976's current affinity list: 0-31
# bin/ceph osd metadata 0 | grep numa
"network_numa_node": "0",
"network_numa_nodes": "0",
"numa_node": "0",
"numa_node_cpus": "0-7,16-23",
"objectstore_numa_node": "1",
"objectstore_numa_nodes": "1",
集群管理
1. dashboard 支持配置 block mirroring pools and peers
dashboard: support configuring block mirroring pools and peers
(https://github.com/ceph/ceph/pull/25210)
RBD mirroring 是集群之间异步备份 RBD 镜像的机制。镜像在对端集群内基于存储池来进行配置,自动备份存储池内所有镜像或者子集。
每个集群的 rbd-mirror 守护进程可以从远程对端集群中异步拉取镜像的更新并将其应用于本地集群的相应镜像。
dashboard 现支持配置镜像同步存储池以及镜像同步对端。
2. ansible 编排模块,加入创建/删除 OSD 的功能
mgr/ansible: Create/Remove OSDs
(https://github.com/ceph/ceph/pull/25497)
命令如下:
ceph orchestrator osd create {drive_group}
ceph orchestrator osd remove {osd_id}
3. balancer 自动平衡存储池
mgr/balancer: auto balance a list of pools
(https://github.com/ceph/ceph/pull/25940)
命令如下:
# 列出可以自动平衡的存储池
ceph balancer pool ls
# 为存储池添加自动平衡
ceph balancer pool add {pool_name}
# 关闭
ceph balancer pool rm {pool_name}
4. Ceph 编排模块加入 NFS 网关支持
Add nfs gateway support to the orchestrator
(https://github.com/ceph/ceph/pull/25633)
命令如下:
ceph orchestrator nfs add {name} {pool} [--namespace={namespace}]
ceph orchestrator nfs update {name} {size} [host…]
ceph orchestrator nfs rm {name}
5. dashboard 加入 RBD 性能仪盘表
mgr/dashboard: incorporate RBD overall performance grafana dashboard
(https://github.com/ceph/ceph/pull/25927)