4.3.2. ストレッチモード用の CRUSH マップを設定する


この情報を使用して、ストレッチモードの CRUSH マップを設定します。

前提条件

始める前に、次の前提条件が満たされていることを確認してください。

  • ノードへの root レベルのアクセス。
  • CRUSH ロケーションがホストに設定されている。

手順

  1. crushtool コマンドを使用するために ceph-base RPM パッケージをインストールして、この OSD クラッシュトポロジーを利用する CRUSH ルールを作成します。

    構文

    dnf -y install ceph-base

  2. コンパイルされた CRUSH マップをクラスターから取得します。

    構文

    ceph osd getcrushmap > /etc/ceph/crushmap.bin

  3. CRUSH マップを逆コンパイルし、テキストファイルに変換して編集します。

    構文

    crushtool -d /etc/ceph/crushmap.bin -o /etc/ceph/crushmap.txt

  4. ファイルの末尾にある /etc/ceph/crushmap.txt を編集して、以下のルールを CRUSH マップに追加します。このルールは、読み取りと書き込みをデータセンター全体に均等に分散します。

    構文

    rule stretch_rule {
            id 1
            type replicated
            step take default
            step choose firstn 0 type datacenter
            step chooseleaf firstn 2 type host
            step emit
     }

    1. 必要に応じて、データセンター 1 に対する読み取り/書き込みアフィニティーを持つクラスターを作成します。

      構文

      rule stretch_rule {
               id 1
               type replicated
               step take DC1
               step chooseleaf firstn 2 type host
               step emit
               step take DC2
               step chooseleaf firstn 2 type host
               step emit
       }

      The CRUSH rule declared contains the following information:
           Rule name
                Description: A unique name for identifying the rule.
                Value: stretch_rule
           id
                Description: A unique whole number for identifying the rule.
                Value: 1
           type
                Description: Describes a rule for either a storage drive replicated or erasure-coded.
                Value: replicated
           step take default
                Description: Takes the root bucket called default, and begins iterating down the tree.
           step take DC1
                Description: Takes the bucket called DC1, and begins iterating down the tree.
           step choose firstn 0 type datacenter
                Description: Selects the datacenter bucket, and goes into its subtrees.
           step chooseleaf firstn 2 type host
                Description: Selects the number of buckets of the given type. In this case, it is two different hosts located in the datacenter it entered at the previous level.
           step emit
                Description: Outputs the current value and empties the stack. Typically used at the end of a rule, but may also be used to pick from different trees in the same rule.
  5. /etc/ceph/crushmap.txt から新しい CRUSH マップをコンパイルし、バイナリーファイル /etc/ceph/crushmap2.bin に変換します。

    構文

    crushtool -c /path/to/crushmap.txt -o /path/to/crushmap2.bin

    [ceph: root@host01 /]# crushtool -c /etc/ceph/crushmap.txt -o /etc/ceph/crushmap2.bin

  6. 新しく作成された CRUSH マップをクラスターに再度注入します。

    構文

    ceph osd setcrushmap -i /path/to/compiled_crushmap

    [ceph: root@host01 /]# ceph osd setcrushmap -i /path/to/compiled_crushmap
    17

    注記

    数字 17 はカウンターであり、CRUSH マップに加えられた変更に応じて増加します (18、19 など)。

検証

新しく作成された stretch_rule が使用可能であることを確認します。

構文

ceph osd crush rule ls

[ceph: root@host01 /]# ceph osd crush rule ls

replicated_rule
stretch_rule

4.3.2.1. ストレッチモードへの切り替え

ストレッチモードは 2 つのサイトを処理するように設計されています。2 サイトクラスターでは、コンポーネントの可用性が失われるリスクが低くなります。

前提条件

始める前に、次の前提条件が満たされていることを確認してください。

  • ノードへの root レベルのアクセス。
  • CRUSH ロケーションがホストに設定されている。
  • ストレッチルールを含むように設定された CRUSH マップ。
  • クラスター内にイレイジャーコーディングされたプールがない。
  • 2 つのサイトの重みが同じである。

手順

  1. モニターが使用する現在の選出ストラテジーを確認します。

    構文

    ceph mon dump | grep election_strategy

    注記

    Ceph クラスターの election_strategy は、デフォルトで 1 に設定されています。

    [ceph: root@host01 /]# ceph mon dump | grep election_strategy
    
    dumped monmap epoch 9
    election_strategy: 1

  2. 選出ストラテジーを connectivity に変更します。

    構文

    ceph mon set election_strategy connectivity

    選出ストラテジーの設定の詳細は、モニター選択ストラテジーの設定 を参照してください。

  3. ceph mon dump コマンドを使用して、選出ストラテジーが 3 に更新されたことを確認します。

    [ceph: root@host01 /]# ceph mon dump | grep election_strategy
    
    dumped monmap epoch 22
    election_strategy: 3

  4. tiebreaker モニターの場所を、データセンター間で分割するように設定します。

    構文

    ceph mon set_location TIEBREAKER_HOST datacenter=DC3

    [ceph: root@host01 /]# ceph mon set_location host07 datacenter=DC3

  5. tiebreaker モニターが期待どおりに設定されていることを確認します。

    構文

    ceph mon dump

    [ceph: root@host01 /]# ceph mon dump
    
    epoch 8
    
    fsid 4158287e-169e-11f0-b1ad-fa163e98b991
    
    last_changed 2025-04-11T07:14:48.652801+0000
    
    created 2025-04-11T06:29:24.974553+0000
    
    min_mon_release 19 (squid)
    
    election_strategy: 3
    
    0: [v2:10.0.57.33:3300/0,v1:10.0.57.33:6789/0] mon.host07; crush_location {datacenter=DC3}
    
    1: [v2:10.0.58.200:3300/0,v1:10.0.58.200:6789/0] mon.host05; crush_location {datacenter=DC2}
    
    2: [v2:10.0.58.47:3300/0,v1:10.0.58.47:6789/0] mon.host02; crush_location {datacenter=DC1}
    
    3: [v2:10.0.58.104:3300/0,v1:10.0.58.104:6789/0] mon.host04; crush_location {datacenter=DC2}
    
    4: [v2:10.0.58.38:3300/0,v1:10.0.58.38:6789/0] mon.host01; crush_location {datacenter=DC1}
    
    dumped monmap epoch 8
    0

  6. ストレッチモードに入ります。

    構文

    ceph mon enable_stretch_mode TIEBREAKER_HOST STRETCH_RULE STRETCH_BUCKET

    以下の例では、下記の点を前提としています。

    • tiebreaker ノードは host07 として設定されている。
    • ストレッチルールは、xx で作成された stretch_rule である。
    • ストレッチバケットはデータセンターとして設定されている。
[ceph: root@host01 /]# ceph mon enable_stretch_mode host07 stretch_rule datacenter

検証

CROSREF を続行して、ストレッチモードが正しく実装されていることを確認します。

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る