Pacemaker/Corosync の設定値について

Pacemaker/Corosync には多数の設定項目があります。その中の必須項目以外はデフォルト値が適用されますが、そのデフォルト値は動作環境や要件によっては、必ずしも適切でないことも多いです。本記事では主な設定項目のデフォルト値や、注意点などについて説明します。

Pacemakerの設定のデフォルト値について

Pacemakerの設定には主に以下の種類があります。

  • クラスタのプロパティ
  • リソースのパラメータ
  • 制約のパラメータ

各種設定のデフォルト値は以下のドキュメントに記載されています。

以下、主に検討が必要な設定項目について説明します。

クラスタのプロパティ

  • no-quorum-policy: クラスタがquorumを持っていないときの動作を定義します。デフォルトはstop(全リソース停止)です。
    2台構成の場合は、片方が停止しても動作を続行できるよう、ignore(全リソースはそのまま動作を続行)を指定します。
  • stonith-enabled: フェンシング(STONITH)を有効にするかどうかを指定します。デフォルトはtrue(有効)です。
    これが有効、かつSTONITHリソースが未設定の場合リソースが起動できません。
  • cluster-recheck-interval: クラスタのチェック間隔を指定します。デフォルトは15分です。
    failure-timeout(failcountを自動クリアするまでの時間)など、時間ベースの動作が反映されるまでの時間に影響します。

クラスタの設定のデフォルト値についてはRed Hat社の以下のページも参照ください。

リソースのパラメータ

リソースのパラメータには共通のものと、特定のリソース固有のものがあります。
共通のものについてはクラスタにおけるデフォルト値を設定することができます。

  • migration-threshold: リソースをフェイルオーバーするまでの障害の発生回数(failcount)を指定します。デフォルトはINFINITY(無効)です。
    failcountがこの値に達するまでPacemakerはリソースの再起動により復旧を試みます。
  • failure-timeout: 障害検知によりfailcountがカウントされた後、一定時間障害が発生しなかった場合にfailcount自動でクリアします。デフォルトは0(無効)です。
    この値を短くしても、実際に条件を満たしたかどうかがチェックされるのはcluster-recheck-interval(デフォルト:15分)の間隔となるため、failcountの自動クリアを早くしたい場合は両方の値を調整する必要があります。

リソース固有のパラメータについては、以下のコマンドで確認することができます。

(crm) crm ra info <リソース名>
(pcs) pcs resource describe <リソース名>

(ocf:pacemaker:pingリソースの場合の例)

# crm ra info ping
node connectivity (ocf:pacemaker:ping)

Every time the monitor action is run, this resource agent records (in the CIB) the current number of nodes the host can
 connect to using the system fping (preferred) or ping tool.

Parameters (*: required, []: default):

pidfile (string, [/var/run/ping-ping]):
    PID file

dampen (integer, [5s]): Dampening interval
    The time to wait (dampening) further changes occur
...
Operations' defaults (advisory minimum):

    start timeout=60
    stop timeout=20
    monitor timeout=60 interval=10

# pcs resource describe ping
Assumed agent name 'ocf:pacemaker:ping' (deduced from 'ping')
ocf:pacemaker:ping - node connectivity

Every time the monitor action is run, this resource agent records (in the CIB) the current number of nodes the host can
 connect to using the system fping (preferred) or ping tool.

Resource options:
  pidfile: PID file
  dampen: The time to wait (dampening) further changes occur
  name: The name of the attributes to set. This is the name to be used in the constraints.
  multiplier: The number by which to multiply the number of connected ping nodes by
  host_list (required): A space separated list of ping nodes to count.
...

Default operations:
  start: interval=0s timeout=60
  stop: interval=0s timeout=20
  monitor: interval=10 timeout=60

リソースの設定のデフォルト値についてはRed Hat社の以下のページも参照ください。

High Availability Add-On リファレンス – 6.4. リソースのメタオプション

Corosyncの設定のデフォルト値について

Corosyncの設定のデフォルト値はman corosync.confで表示されるマニュアルページにに記載されています。

totem {}

クラスタ間の通信方法などを定義します。

  • transport: クラスタ間の通信プロトコル。デフォルトはudp(UDPマルチキャスト通信)です。udpuにするとUDPユニキャスト通信となります。
  • token: Corosync間の通信のタイムアウト値を指定します。デフォルトは1000ミリ秒(1秒)です。
    デフォルト値は多くの場合短すぎるため、要件に応じて10000ミリ秒(10秒)程度に長くすることを検討してください。
totem {
    version: 2
    crypto_cipher: none
    crypto_hash: none
    cluster_name: cluster1
    transport: udpu
    token: 10000
}

quorum {}

  • two_node: 2ノードクラスタの場合1を指定する必要があります。デフォルトは無効です。
quorum {
    provider: corosync_votequorum
    two_node: 1
}

設定値の単位について

Pacemakerの場合、監視間隔やタイムアウトなどの時間の指定は「10s」「1m」「10000ms」などの単位が指定できます。単位を指定しない場合は秒数として扱われます。以下の単位が使用できます。

s, sec 秒(接尾辞なしと同じ)
ms, msec ミリ秒
us, usec マイクロ秒
m, min
h, hr

(複数の単位を使用した例)

crm configure primitive ping ocf:pacemaker:ping 
  params host_list="x.x.x.x" 
  op start interval="0s" timeout="1m" on-fail="restart" 
  op monitor interval="10000ms" timeout="60s" on-fail="restart" 
  op stop interval="0" timeout="60" on-fail="fence"

pcs resource create ping ocf:pacemaker:ping 
  host_list="x.x.x.x" 
  op start interval="0s" timeout="1m" on-fail="restart" 
  op monitor interval="10000ms" timeout="60s" on-fail="restart" 
  op stop interval="0" timeout="60" on-fail="fence"

Corosyncの場合、tokenなどの時間はミリ秒単位で指定します。単位は指定できません。