注意

本文档适用于 Ceph 开发版本。

去重编码池

目的

与复制池相比,去重编码池需要的存储空间更少。去重编码支持具有更高的计算需求,并且仅支持对象上允许操作的一个子集(例如,不支持部分写入)。

应用场景

冷存储

创建一个去重编码池来存储大量 1GB 对象(图像、基因组学等),其中每月有 10% 的对象被读取。每天都会添加新对象,并且写入后对象不会被修改。平均每 10,000 次读取有一次写入。

创建一个复制池并将其设置为去重编码池的缓存层。如果对象在一周内未被访问,代理会降级对象(即将其从复制池移动到去重编码池)。

去重编码池的 CRUSH 规则针对为冷存储设计的硬件,具有高延迟和慢访问时间。复制池的 CRUSH 规则针对更快的硬件,以提供更好的响应时间。

低成本多数据中心存储

十个数据中心通过专用网络链路连接。每个数据中心包含相同数量的存储,没有电源备份,也没有空调系统。

创建一个去重编码池,其 CRUSH 规则将确保最多三个数据中心同时发生故障时不会丢失数据。配置去重编码时,数据被分成六份(k=6),并创建三个编码块(m=3),开销为 50%。使用复制时,开销将是 400%(四个副本)。

接口

设置去重编码池:

$ ceph osd pool create ecpool erasure

设置去重编码池和相关 CRUSH 规则ecrule:

$ ceph osd crush rule create-erasure ecrule
$ ceph osd pool create ecpool erasure default ecrule

将 CRUSH 故障域设置为 osd(而不是默认的 host):

$ ceph osd erasure-code-profile set myprofile \
    crush-failure-domain=osd
$ ceph osd erasure-code-profile get myprofile
k=2
m=2
plugin=isa
technique=reed_sol_van
crush-failure-domain=osd
$ ceph osd pool create ecpool erasure myprofile

控制去重编码插件参数:

$ ceph osd erasure-code-profile set myprofile \
    k=3 m=2
$ ceph osd erasure-code-profile get myprofile
k=3
m=2
plugin=isa
technique=reed_sol_van
$ ceph osd pool create ecpool erasure myprofile

选择另一个去重编码插件:

$ ceph osd erasure-code-profile set myprofile \
    plugin=example technique=xor
$ ceph osd erasure-code-profile get myprofile
k=2
m=2
plugin=example
technique=xor
$ ceph osd pool create ecpool 12 12 erasure \
    myprofile

显示默认去重编码配置文件:

$ ceph osd erasure-code-profile ls
default
$ ceph osd erasure-code-profile get default
k=2
m=2
plugin=isa
technique=reed_sol_van

创建一个配置文件来设置数据在六个 OSD 上分布(k+m=6),并能在不丢失数据的情况下承受三个 OSD 的丢失(m=3):

$ ceph osd erasure-code-profile set myprofile k=3 m=3
$ ceph osd erasure-code-profile get myprofile
k=3
m=3
plugin=isa
technique=reed_sol_van
$ ceph osd erasure-code-profile ls
default
myprofile

删除不再使用的配置文件(否则它将因 EBUSY 而失败):

$ ceph osd erasure-code-profile ls
default
myprofile
$ ceph osd erasure-code-profile rm myprofile
$ ceph osd erasure-code-profile ls
default

将规则设置为 ssd(而不是默认的):

$ ceph osd erasure-code-profile set myprofile \
    crush-root=ssd
$ ceph osd erasure-code-profile get myprofile
k=2
m=2
plugin=isa
technique=reed_sol_van
crush-root=ssd

由 Ceph 基金会带给您

Ceph 文档是一个社区资源,由非盈利的 Ceph 基金会资助和托管Ceph Foundation. 如果您想支持这一点和我们的其他工作,请考虑加入现在加入.