前回の
リソースが故障した場合どうなるの?
Pacemakerで想定されるリソースの故障は、
on-fail設定値 | Pacemakerの動作 |
---|---|
block | 故障したリソースの管理を停止し、 |
fence | リソース故障が発生したサーバをSTONITHによって再起動し、 |
ignore | 何も処理を行いません。 |
stop | 故障したリソースを停止し、 |
restart | 故障したリソースを他のサーバへフェイルオーバさせます。 |
ここでは、

故障を発生させてみよう
では、実際にリソース故障を発生させて、Pacemakerの動きを見てみましょう。今回はリソース故障を擬似的に起こすため、Pacemaker稼働中にhttpdを停止します。# /etc/init.d/httpd stop
httpd停止後crm_
Online: [ pm01 pm02 ] Resource Group: web vip (ocf::heartbeat:IPaddr2): Started pm02 httpd (ocf::heartbeat:apache): Started pm02 省略 Migration summary: Node pm01: httpd: migration-threshold=1 fail-count=1 * Node pm02: Failed actions: httpd_monitor_10000 (node=pm01, call=76, rc=7, status=complete): not running
このとき、
Mar 30 13:08:51 pm01 ERROR: Resource httpd does not work. (rc=7)
復旧してみよう
復旧では、
# crm resource cleanup httpd pm01 Cleaning up httpd on pm01 Waiting for 2 replies from the CRMd..
コマンド実行後のモニタ表示では、
Online: [ pm01 pm02 ] Resource Group: web vip (ocf::heartbeat:IPaddr2): Started pm02 httpd (ocf::heartbeat:apache): Started pm02 省略 Node Attributes: * Node pm01: + default_ping_set : 100 + pm02-eth1 : up + pm02-eth2 : up * Node pm02: + default_ping_set : 100 + pm01-eth1 : up + pm01-eth2 : up 省略 Migration summary: * Node pm01: * Node pm02:
リソースを稼動していたサーバに戻したい場合は、
# crm resource move web pm01 force
コマンド実行後のモニタ表示では、
Online: [ pm01 pm02 ] Resource Group: web vip (ocf::heartbeat:IPaddr2): Started pm01 httpd (ocf::heartbeat:apache): Started pm01
pm01でリソースが稼動していることを確認した上で、 Pacemakerは複数のプロセスで構成されており、 ここでは、 では、 プロセス故障後pm02のモニタ表示では、 このとき、 また、 復旧では、 Pacemaker起動後、 リソースを稼動していたサーバに戻したい場合は、 保守運用編では、 これまで全5回にわたりPacemakerの歴史から構築、 お付き合いありがとうございました。# crm resource unmove web
Pacemakerのプロセス故障が起きた場合はどうなるの?
Pacemaker プロセス プロセス故障時の挙動 heartbeat: master control process サーバ再起動 ccm cib crmd lrmd pengine heartbeat: FIFO reader プロセス再起動 heartbeat: write: bcast ethX heartbeat: read: bcast ethX stonithd attrd ifcheckd
故障を発生させてみよう
# ps -aef | grep "master control process" | grep -v grep
root 1035 1 0 14:06 ? 00:00:00 heartbeat: master control process
# kill -KILL 1035
Online: [ pm02 ]
OFFLINE: [ pm01 ]
Resource Group: web
vip (ocf::heartbeat:IPaddr2): Started pm02
httpd (ocf::heartbeat:apache): Started pm02
Resource Group: grpStonith1
stonith1-1 (stonith:external/stonith-helper): Started pm02
stonith1-2 (stonith:external/ipmi): Started pm02
stonith1-3 (stonith:meatware): Started pm02
Clone Set: clone_ping
Started: [ pm02 ]
Stopped: [ ping:0 ]
Node Attributes:
* Node pm02:
+ default_ping_set : 100
Migration summary:
* Node pm02:
Mar 30 14:42:59 pm01 ERROR: Emergency Shutdown: Master Control process died.
Mar 30 14:43:09 pm02 info: Try to STONITH (RESET) the Node pm01 to stonith1-1 (external/stonith-helper) (pid=735)
Mar 30 14:43:54 pm02 ERROR: Failed to STONITH the Node pm01 with one local device (exitcode=5). Will try to use the next local device.
Mar 30 14:43:54 pm02 info: Try to STONITH (RESET) the Node pm01 to stonith1-2 (external/ipmi) (pid=9137)
Mar 30 14:43:57 pm02 info: Succeeded to STONITH (RESET) the Node pm01 by Node pm02.
復旧してみよう
# /etc/init.d/heartbeat start
Starting High-Availability services: [ OK ]
Online: [ pm01 pm02 ]
Resource Group: web
vip (ocf::heartbeat:IPaddr2): Started pm02
httpd (ocf::heartbeat:apache): Started pm02
Resource Group: grpStonith1
stonith1-1 (stonith:external/stonith-helper): Started pm02
stonith1-2 (stonith:external/ipmi): Started pm02
stonith1-3 (stonith:meatware): Started pm02
Resource Group: grpStonith2
stonith2-1 (stonith:external/stonith-helper): Started pm01
stonith2-2 (stonith:external/ipmi): Started pm01
stonith2-3 (stonith:meatware): Started pm01
Clone Set: clone_ping
Started: [ pm01 pm02 ]
Node Attributes:
* Node pm01:
+ default_ping_set : 100
+ pm02-eth1 : up
+ pm02-eth2 : up
* Node pm02:
+ default_ping_set : 100
+ pm01-eth1 : up
+ pm01-eth2 : up
Migration summary:
* Node pm01:
* Node pm02:
まとめ