Pacemaker で想定される故障は、start[起動失敗], monitor[監視による検出], stop[停止失敗]の3パターンがあります。故障が発生した際は、on-fail の設定に応じた動作を行います。on-fail を指定しない場合は、デフォルトの restart が適用されます。on-fail で指定可能な設定値は下記のとおりです。
リソースフェイルオーバーの確認
pm01 の設定を確認します。
node $id="420126ea-1e1e-4632-b4fb-eaa2a8915909" pm02 \
attributes standby="off"
node $id="ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9" pm01 \
attributes standby="off"
primitive apache lsb:httpd \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="30s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="fence"
primitive mnt_fs ocf:heartbeat:Filesystem \
params device="/dev/sdb2" directory="/data" fstype="ext3" \
op monitor interval="20s" timeout="40s" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="60s"
primitive pingd ocf:pacemaker:pingd \
params name="default_ping_set" host_list="192.168.1.2" interval="10" timeout="10" attempts="5" multiplier="100" \
op start interval="0" timeout="90" on-fail="restart" \
op monitor interval="10" timeout="20" on-fail="restart" start-delay="1m" debug="true" \
op stop interval="0" timeout="100" on-fail="block"
primitive vip ocf:heartbeat:IPaddr2 \
params ip="192.168.1.103" cidr_netmask="24" nic="eth0" iflabel="0" \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="10s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="block"
group Cluster vip mnt_fs apache
clone clone_ping pingd
location vip_location vip \
rule $id="vip_location-rule" -inf: not_defined default_ping_set or default_ping_set lt 100
property $id="cib-bootstrap-options" \
dc-version="1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87" \
cluster-infrastructure="Heartbeat" \
stonith-enabled="false" \
no-quorum-policy="ignore"
rsc_defaults $id="rsc-options" \
resource-stickiness="INFINITY" \
migration-threshold="3"
リソース故障が1回発生するとフェイルオーバーするように設定を変更します。
<...snip...>
rsc_defaults $id="rsc-options" \
resource-stickiness="INFINITY" \
migration-threshold="1"※値を 3 から 1 に変更します。
リソースの状況を確認します。※-f オプション故障状況を確認できます。
============
Last updated: Tue May 28 03:37:46 2013
Stack: Heartbeat
Current DC: pm01 (ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9) - partition with quorum
Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
2 Nodes configured, unknown expected votes
2 Resources configured.
============
Online: [ pm02 pm01 ]
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2): Started pm01
mnt_fs (ocf::heartbeat:Filesystem): Started pm01
apache (lsb:httpd): Started pm01
Clone Set: clone_ping
Started: [ pm02 pm01 ]
Migration summary:
* Node pm02:
* Node pm01:
プロセス故障を想定し、リソース[apache]を kill します。
apache 7438 7436 0 03:44 ? 00:00:00 /usr/sbin/httpd
リソース故障を検知しプロセスの再起動を試みます。再起動に成功すると、fail-count が加算されます。
fail-count の合計が migration-threshold を超過すると、リソースをフェイルオーバーします。
再起動に失敗した場合は、fail-count は INFINITY となり、即時フェイルオーバします。
本例では、migration-threshold を 1 に指定しているので、pm02 へフェイルオーバします。
============
Last updated: Tue May 28 03:47:47 2013
Stack: Heartbeat
Current DC: pm01 (ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9) - partition with quorum
Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
2 Nodes configured, unknown expected votes
2 Resources configured.
============
Online: [ pm02 pm01 ]
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2): Started pm02
mnt_fs (ocf::heartbeat:Filesystem): Started pm02
apache (lsb:httpd): Started pm02
Clone Set: clone_ping
Started: [ pm02 pm01 ]
Migration summary:
* Node pm02:
* Node pm01:
apache: migration-threshold=1 fail-count=1 ※ fail-count がカウントされています。
Failed actions:
apache_monitor_30000 (node=pm01, call=22, rc=7, status=complete): not running
fail-count がカウントされているノードは、リソースを管理する事ができません。
当該ノードへリソースを移行するためには、fail-count をクリアする必要があります。
リソースの設定状況を確認します。
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2) Started
mnt_fs (ocf::heartbeat:Filesystem) Started
apache (lsb:httpd) Started
Clone Set: clone_ping
Started: [ pm02 pm01 ]
リソース[apache]の fail-count を確認します。
scope=status name=fail-count-apache value=1
リソース[apache]の fail-count をクリアします。
リソース[apache]の fail-count がクリアされ、値が 0 となります。
scope=status name=fail-count-apache value=0
fail-count はクリアされましたが、故障履歴[Faied actions]が残っています。
============
Last updated: Tue May 28 04:03:35 2013
Stack: Heartbeat
Current DC: pm01 (ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9) - partition with quorum
Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
2 Nodes configured, unknown expected votes
2 Resources configured.
============
Online: [ pm02 pm01 ]
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2): Started pm02
mnt_fs (ocf::heartbeat:Filesystem): Started pm02
apache (lsb:httpd): Started pm02
Clone Set: clone_ping
Started: [ pm02 pm01 ]
Migration summary:
* Node pm02:
* Node pm01:
Failed actions:
apache_start_0 (node=pm01, call=36, rc=1, status=complete): unknown error
故障履歴[Faied actions]をクリアします。
Cleaning up apache on pm01
Waiting for 2 replies from the CRMd..
fail-count 及び Faied actions がクリアされました。
============
Last updated: Tue May 28 04:07:18 2013
Stack: Heartbeat
Current DC: pm01 (ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9) - partition with quorum
Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
2 Nodes configured, unknown expected votes
2 Resources configured.
============
Online: [ pm02 pm01 ]
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2): Started pm02
mnt_fs (ocf::heartbeat:Filesystem): Started pm02
apache (lsb:httpd): Started pm02
Clone Set: clone_ping
Started: [ pm02 pm01 ]
Migration summary:
* Node pm02:
* Node pm01:
リソーススイッチバックの確認
pm02 へ resource move を実行しリソースを pm01 へ戻します。
WARNING: Creating rsc_location constraint 'cli-standby-Cluster' with a score of -INFINITY for resource Cluster on pm02.
This will prevent Cluster from running on pm02 until the constraint is removed using the 'crm_resource -U' command or manually with cibadmin
This will be the case even if pm02 is the last node in the cluster
This message can be disabled with -Q
pm01 へリソースが移動します。
============
Last updated: Tue May 28 04:57:08 2013
Stack: Heartbeat
Current DC: pm02 (420126ea-1e1e-4632-b4fb-eaa2a8915909) - partition with quorum
Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
2 Nodes configured, unknown expected votes
2 Resources configured.
============
Online: [ pm02 pm01 ]
Resource Group: Cluster
vip (ocf::heartbeat:IPaddr2): Started pm01
mnt_fs (ocf::heartbeat:Filesystem): Started pm01
apache (lsb:httpd): Started pm01
Clone Set: clone_ping
Started: [ pm02 pm01 ]
Migration summary:
* Node pm02:
* Node pm01:
同時に移動元に移動禁止フラグがたちます。
node $id="420126ea-1e1e-4632-b4fb-eaa2a8915909" pm02 \
attributes standby="off"
node $id="ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9" pm01 \
attributes standby="off"
primitive apache lsb:httpd \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="30s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="fence"
primitive mnt_fs ocf:heartbeat:Filesystem \
params device="/dev/sdb2" directory="/data" fstype="ext3" \
op monitor interval="20s" timeout="40s" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="60s"
primitive pingd ocf:pacemaker:pingd \
params name="default_ping_set" host_list="192.168.1.2" interval="10" timeout="10" attempts="5" multiplier="100" \
op start interval="0" timeout="90" on-fail="restart" \
op monitor interval="10" timeout="20" on-fail="restart" start-delay="1m" debug="true" \
op stop interval="0" timeout="100" on-fail="block"
primitive vip ocf:heartbeat:IPaddr2 \
params ip="192.168.1.103" cidr_netmask="24" nic="eth0" iflabel="0" \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="10s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="block"
group Cluster vip mnt_fs apache
clone clone_ping pingd
location cli-prefer-Cluster Cluster \
rule $id="cli-prefer-rule-Cluster" inf:
location cli-standby-Cluster Cluster \
rule $id="cli-standby-rule-Cluster" -inf:
location vip_location vip \
rule $id="vip_location-rule" -inf: not_defined default_ping_set or default_ping_set lt 100
property $id="cib-bootstrap-options" \
dc-version="1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87" \
cluster-infrastructure="Heartbeat" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
last-lrm-refresh="1369683385"
rsc_defaults $id="rsc-options" \
resource-stickiness="INFINITY" \
migration-threshold="1"
移動禁止フラグが立つと pm02 へフェイルオーバーできないためクリアします。
移動禁止フラグが削除されます。
node $id="420126ea-1e1e-4632-b4fb-eaa2a8915909" pm02 \
attributes standby="off"
node $id="ca3de0e0-dff2-4d13-a126-b9fbee7e3ec9" pm01 \
attributes standby="off"
primitive apache lsb:httpd \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="30s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="fence"
primitive mnt_fs ocf:heartbeat:Filesystem \
params device="/dev/sdb2" directory="/data" fstype="ext3" \
op monitor interval="20s" timeout="40s" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="60s"
primitive pingd ocf:pacemaker:pingd \
params name="default_ping_set" host_list="192.168.1.2" interval="10" timeout="10" attempts="5" multiplier="100" \
op start interval="0" timeout="90" on-fail="restart" \
op monitor interval="10" timeout="20" on-fail="restart" start-delay="1m" debug="true" \
op stop interval="0" timeout="100" on-fail="block"
primitive vip ocf:heartbeat:IPaddr2 \
params ip="192.168.1.103" cidr_netmask="24" nic="eth0" iflabel="0" \
op start interval="0s" timeout="60s" on-fail="restart" \
op monitor interval="10s" timeout="60s" on-fail="restart" \
op stop interval="0s" timeout="60s" on-fail="block"
group Cluster vip mnt_fs apache
clone clone_ping pingd
location vip_location vip \
rule $id="vip_location-rule" -inf: not_defined default_ping_set or default_ping_set lt 100
property $id="cib-bootstrap-options" \
dc-version="1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87" \
cluster-infrastructure="Heartbeat" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
last-lrm-refresh="1369683385"
rsc_defaults $id="rsc-options" \
resource-stickiness="INFINITY" \
migration-threshold="1"