Red Hat Training

A Red Hat training course is available for RHEL 8

27.2. クォーラムデバイスの設定

次の手順でクォーラムデバイスを設定し、クラスターに追加します。

この例では、以下のように設定されています。

  • クォーラムデバイスに使用されるノードは qdevice です。
  • クォーラムデバイスモデルは net で、これは現在対応している唯一のクォーラムデバイスモデルです。net モデルは、以下のアルゴリズムに対応します。

    • ffsplit (fifty-fifty split) -これにより、アクティブなノードの数が最も多いパーティションに 1 票が提供されます。
    • lms (last-man-standing) -ノードが qnetd サーバーを確認できるクラスター内に残っている唯一のノードである場合に、1 票が返されます。

      警告

      LMS アルゴリズムにより、ノードが 1 つしか残っていなくてもクラスターはクォーラムを維持できますが、number_of_nodes - 1 と同じであるため、クォーラムデバイスの投票力が大きいことを意味します。クォーラムデバイスとの接続が失われると、number_of_nodes - 1 の票が失われます。つまり、(クォーラムデバイスを無効にすることで) すべてのノードがアクティブなクラスターのみがクォーラムに達したままになります。他のクラスターは、クォーラムに達しなくなります。

      これらのアルゴリズムの実装の詳細は、man ページの corosync-qdevice(8) を参照してください。

  • クラスターノードは node1node2 です。

手順

  1. クォーラムデバイスをホストするために使用するノードで以下のコマンドを使用し、クォーラムデバイスを設定します。このコマンドは、クォーラムデバイスモデルである net を設定および開始し、システムの起動時にデバイスが開始するように設定します。

    [root@qdevice:~]# pcs qdevice setup model net --enable --start
    Quorum device 'net' initialized
    quorum device enabled
    Starting quorum device...
    quorum device started

    クォーラムデバイスの設定後、そのステータスを確認できます。corosync-qnetd デーモンが実行中であり、この時点でクライアントが接続されていないことが分かります。--full コマンドオプションを指定すると詳細が出力されます。

    [root@qdevice:~]# pcs qdevice status net --full
    QNetd address:                  *:5403
    TLS:                            Supported (client certificate required)
    Connected clients:              0
    Connected clusters:             0
    Maximum send/receive size:      32768/32768 bytes
  2. 以下のコマンドを実行して、firewalldhigh-availability サービスを有効にして、pcsd デーモンおよび net クォーラムデバイスで必要なファイアウォールのポートを有効にします。

    [root@qdevice:~]# firewall-cmd --permanent --add-service=high-availability
    [root@qdevice:~]# firewall-cmd --add-service=high-availability
  3. 既存クラスターのいずれかのノードにより、クォーラムデバイスをホストしているノードで hacluster ユーザーを認証します。これにより、クラスターの pcsqdevice ホストの pcs にアクセスできるようになりますが、qdevice ホストの pcs は、クラスターの pcs に接続することを許可しません。

    [root@node1:~] # pcs host auth qdevice
    Username: hacluster
    Password:
    qdevice: Authorized
  4. クォーラムデバイスをクラスターに追加します。

    クォーラムデバイスを追加する前に、後で比較するために、クォーラムデバイスの現在の設定と状況を確認できます。このコマンドの出力から、クラスターがクォーラムデバイスを使用しておらず、各ノードの Qdevice メンバーシップのステータスが NR (登録されていない) であることが分かります。

    [root@node1:~]# pcs quorum config
    Options:
    [root@node1:~]# pcs quorum status
    Quorum information
    ------------------
    Date:             Wed Jun 29 13:15:36 2016
    Quorum provider:  corosync_votequorum
    Nodes:            2
    Node ID:          1
    Ring ID:          1/8272
    Quorate:          Yes
    
    Votequorum information
    ----------------------
    Expected votes:   2
    Highest expected: 2
    Total votes:      2
    Quorum:           1
    Flags:            2Node Quorate
    
    Membership information
    ----------------------
        Nodeid      Votes    Qdevice Name
             1          1         NR node1 (local)
             2          1         NR node2

    以下のコマンドは、作成しておいたクォーラムデバイスをクラスターに追加します。複数のクォーラムデバイスをクラスターで同時に使用することはできません。ただし、複数のクラスターが 1 つのクォーラムデバイスを同時に使用することはできます。以下のコマンド例では、ffsplit アルゴリズムを使用するようにクォーラムデバイスを設定します。クォーラムデバイスの設定オプションの詳細は、man ページの corosync-qdevice (8) を参照してください。

    [root@node1:~]# pcs quorum device add model net host=qdevice algorithm=ffsplit
    Setting up qdevice certificates on nodes...
    node2: Succeeded
    node1: Succeeded
    Enabling corosync-qdevice...
    node1: corosync-qdevice enabled
    node2: corosync-qdevice enabled
    Sending updated corosync.conf to nodes...
    node1: Succeeded
    node2: Succeeded
    Corosync configuration reloaded
    Starting corosync-qdevice...
    node1: corosync-qdevice started
    node2: corosync-qdevice started
  5. クォーラムデバイスの設定状態をチェックします。

    クラスター側から以下のコマンドを実行すると、設定の変更内容を確認できます。

    pcs quorum config は、設定されたクォーラムデバイスを表示します。

    [root@node1:~]# pcs quorum config
    Options:
    Device:
      Model: net
        algorithm: ffsplit
        host: qdevice

    pcs quorum status コマンドは、クォーラムデバイスのステータスを表示し、クォーラムデバイスが使用中であることを示します。各クラスターノードの Qdevice メンバーシップ情報のステータス値の意味は以下のとおりです。

    • A/NA - クォーラムデバイスはが有効かどうか、つまり qdevicecorosync の間にハートビートがあるかどうかを示します。この値は常に、クォーラムデバイスが有効でなければなりません。
    • V/NV - クォーラムデバイスがノードに投票した場合には V に設定されます。この例では、相互に通信できるため、両方のノードが V に設定されます。クラスターを 2 つの単一ノードクラスターに分割する場合には、ノードのいずれかが V に、他のノードは NV に設定されます。
    • MW/NMW - 内部クォーラムデバイスフラグが設定されている (MW) か、設定されていない (NMW) かを示します。デフォルトでは、フラグは設定されず、値は NMW です。

      [root@node1:~]# pcs quorum status
      Quorum information
      ------------------
      Date:             Wed Jun 29 13:17:02 2016
      Quorum provider:  corosync_votequorum
      Nodes:            2
      Node ID:          1
      Ring ID:          1/8272
      Quorate:          Yes
      
      Votequorum information
      ----------------------
      Expected votes:   3
      Highest expected: 3
      Total votes:      3
      Quorum:           2
      Flags:            Quorate Qdevice
      
      Membership information
      ----------------------
          Nodeid      Votes    Qdevice Name
               1          1    A,V,NMW node1 (local)
               2          1    A,V,NMW node2
               0          1            Qdevice

      pcs quorum device status は、クォーラムデバイスのランタイムステータスを表示します。

      [root@node1:~]# pcs quorum device status
      Qdevice information
      -------------------
      Model:                  Net
      Node ID:                1
      Configured node list:
          0   Node ID = 1
          1   Node ID = 2
      Membership node list:   1, 2
      
      Qdevice-net information
      ----------------------
      Cluster name:           mycluster
      QNetd host:             qdevice:5403
      Algorithm:              ffsplit
      Tie-breaker:            Node with lowest node ID
      State:                  Connected

      クォーラムデバイスから次のコマンドを実行して、corosync-qnetd デーモンのステータスを表示できます。

      [root@qdevice:~]# pcs qdevice status net --full
      QNetd address:                  *:5403
      TLS:                            Supported (client certificate required)
      Connected clients:              2
      Connected clusters:             1
      Maximum send/receive size:      32768/32768 bytes
      Cluster "mycluster":
          Algorithm:          ffsplit
          Tie-breaker:        Node with lowest node ID
          Node ID 2:
              Client address:         ::ffff:192.168.122.122:50028
              HB interval:            8000ms
              Configured node list:   1, 2
              Ring ID:                1.2050
              Membership node list:   1, 2
              TLS active:             Yes (client certificate verified)
              Vote:                   ACK (ACK)
          Node ID 1:
              Client address:         ::ffff:192.168.122.121:48786
              HB interval:            8000ms
              Configured node list:   1, 2
              Ring ID:                1.2050
              Membership node list:   1, 2
              TLS active:             Yes (client certificate verified)
              Vote:                   ACK (ACK)