2.10. CRUSH ストレージストラテジーの例
大規模なハードドライブがサポートするほとんどのプールを OSD に指定するとします。ただし、高速ソリッドステートドライブ (SSD) がサポートする OSD にマッピングされているプールもあります。CRUSH は、これらのシナリオを容易に処理できます。
RHCS 2 およびそれ以前
RHCS 2 以前では、同じ CRUSH マップ内に複数の独立した CRUSH 階層を持つことで、異なるパフォーマンスドメインを反映させることができます。ハードディスク (例: "root platter" など) と SSD 用 ("root ssd" など) の 2 つの異なるルートノードを持つ階層を 2 つ定義します。以下に例を示します。
device 0 osd.0
device 1 osd.1
device 2 osd.2
device 3 osd.3
device 4 osd.4
device 5 osd.5
device 6 osd.6
device 7 osd.7
host ceph-osd-ssd-server-1 {
id -1
alg straw
hash 0
item osd.0 weight 1.00
item osd.1 weight 1.00
}
host ceph-osd-ssd-server-2 {
id -2
alg straw
hash 0
item osd.2 weight 1.00
item osd.3 weight 1.00
}
host ceph-osd-platter-server-1 {
id -3
alg straw
hash 0
item osd.4 weight 1.00
item osd.5 weight 1.00
}
host ceph-osd-platter-server-2 {
id -4
alg straw
hash 0
item osd.6 weight 1.00
item osd.7 weight 1.00
}
root platter {
id -5
alg straw
hash 0
item ceph-osd-platter-server-1 weight 2.00
item ceph-osd-platter-server-2 weight 2.00
}
root ssd {
id -6
alg straw
hash 0
item ceph-osd-ssd-server-1 weight 2.00
item ceph-osd-ssd-server-2 weight 2.00
}
rule data {
ruleset 0
type replicated
min_size 2
max_size 2
step take platter
step chooseleaf firstn 0 type host
step emit
}
rule metadata {
ruleset 1
type replicated
min_size 0
max_size 10
step take platter
step chooseleaf firstn 0 type host
step emit
}
rule rbd {
ruleset 2
type replicated
min_size 0
max_size 10
step take platter
step chooseleaf firstn 0 type host
step emit
}
rule platter {
ruleset 3
type replicated
min_size 0
max_size 10
step take platter
step chooseleaf firstn 0 type host
step emit
}
rule ssd {
ruleset 4
type replicated
min_size 0
max_size 4
step take ssd
step chooseleaf firstn 0 type host
step emit
}
rule ssd-primary {
ruleset 5
type replicated
min_size 5
max_size 10
step take ssd
step chooseleaf firstn 1 type host
step emit
step take platter
step chooseleaf firstn -1 type host
step emit
}
続いて、以下のコマンドを実行して、SSD ルールを使用するようにプールを設定できます。
ceph osd pool set <poolname> crush_ruleset 4
- 注記
-
Red Hat は、RHCS 3 以降のリリースの
ruleset設定およびcrush_ruleset設定をサポートしません。
SSD プールは、高速ストレージプールとして機能することができます。同様に、ssd-primary ルールを使用して、プール内の各配置グループを、プライマリーとして SSD を使用し、レプリカとしてプラッターを使用して配置することができます。
RHCS 3 以降
RHCS 3 以降では、デバイスクラスを使用します。このプロセスは、各デバイスにクラスを追加するのがはるかに簡単です。以下に例を示します。
# ceph osd crush set-device-class <class> <osdId> [<osdId>]
# ceph osd crush set-device-class hdd osd.0 osd.1 osd.4 osd.5
# ceph osd crush set-device-class ssd osd.2 osd.3 osd.6 osd.7
次に、デバイスを使用するルールを作成します。
# ceph osd crush rule create-replicated <rule-name> <root> <failure-domain-type> <device-class>:
# ceph osd crush rule create-replicated cold default host hdd
# ceph osd crush rule create-replicated hot default host ssd
最後に、ルールを使用するようにプールを設定します。
ceph osd pool set <poolname> crush_rule <rule-name>
ceph osd pool set cold crush_rule hdd
ceph osd pool set hot crush_rule ssd
1 つの階層が複数のデバイスのクラスに対応できるため、CRUSH マップを手動で編集する必要はありません。RHCS 2 の例と比較すると、デバイスクラスを使用する場合、CRUSH マップは RHCS 3 でもはるかに簡単です。
device 0 osd.0 class hdd
device 1 osd.1 class hdd
device 2 osd.2 class ssd
device 3 osd.3 class ssd
device 4 osd.4 class hdd
device 5 osd.5 class hdd
device 6 osd.6 class ssd
device 7 osd.7 class ssd
host ceph-osd-server-1 {
id -1
alg straw
hash 0
item osd.0 weight 1.00
item osd.1 weight 1.00
item osd.2 weight 1.00
item osd.3 weight 1.00
}
host ceph-osd-server-2 {
id -2
alg straw
hash 0
item osd.4 weight 1.00
item osd.5 weight 1.00
item osd.6 weight 1.00
item osd.7 weight 1.00
}
root default {
id -3
alg straw
hash 0
item ceph-osd-server-1 weight 4.00
item ceph-osd-server-2 weight 4.00
}
rule cold {
ruleset 0
type replicated
min_size 2
max_size 11
step take default class hdd
step chooseleaf firstn 0 type host
step emit
}
rule hot {
ruleset 1
type replicated
min_size 2
max_size 11
step take default class ssd
step chooseleaf firstn 0 type host
step emit
}