CentOS 6.5 でheartbeat/pacemakerの組み合わせを利用して
apacheの冗長構成を試してみた。
仮想IPは設定していないけど。
■ heartbeatの設定
# cat /etc/ha.d/ha.cf pacemaker on logfacility local1 use_logd on debug 0 udpport 694 keepalive 2 warntime 7 deadtime 10 initdead 48 ucast eth1 192.168.2.213 node test212 node test213 #
■ ログ設定
# grep local1 /etc/rsyslog.conf *.info;mail.none;authpriv.none;cron.none;local1.none /var/log/messages local1.* /var/log/ha-log #
■表示用のHTMLを準備
# cat /var/www/html/index.html <html> <body> <h1>Apache test212 is on service.</h1> </body> </html> #
test213にも似たHTMLを用意。
■ RA以外の設定
# crm configure property no-quorum-policy="ignore" stonith-enabled="false" # crm configure rsc_defaults resource-stickiness="INFINITY" migration-threshold="1"
■リソース移行
# crm resource move httpd test212 force
リソースの名前が"httpd"
ノードの名前が"test212"
■crm_mon -fAで状態を表示
# crm_mon -fA ============ Last updated: <日付> Stack: Heartbeat Current DC: test213 (<なんか文字列>) - partition with quorum Version: 1.0.13-30bb726 2 Nodes configured, unknown expected votes 2 Resources configured. ============ Online: [ test212 test213 ] dummy-resource (ocf::pacemaker:Dummy): Started test213 httpd (ocf::heartbeat:apache): Started test212 Node Attributes: * Node test212: * Node test213: Migration summary: * Node test212: * Node test213:
■いろいろ設定した結果
# crm configure show node $id="b0a809f7-29fd-4f76-a14b-1c3cc041320e" test213 node $id="f0655572-0f48-4ace-a8c6-c8c87cb92dac" test212 primitive dummy-resource ocf:pacemaker:Dummy \ op start interval="0s" timeout="90s" \ op monitor interval="3s" timeout="20s" \ op stop interval="0s" timeout="100s" primitive httpd ocf:heartbeat:apache \ params configfile="/etc/httpd/conf/httpd.conf" statusurl="http://localhost/" \ op monitor interval="10s" location cli-prefer-dummy-resource dummy-resource \ rule $id="cli-prefer-rule-dummy-resource" inf: #uname eq test212 location cli-prefer-httpd httpd \ rule $id="cli-prefer-rule-httpd" inf: #uname eq test212 location cli-standby-dummy-resource dummy-resource \ rule $id="cli-standby-rule-dummy-resource" -inf: #uname eq test213 location cli-standby-httpd httpd \ rule $id="cli-standby-rule-httpd" -inf: #uname eq test213 property $id="cib-bootstrap-options" \ dc-version="1.0.13-30bb726" \ cluster-infrastructure="Heartbeat" \ no-quorum-policy="ignore" \ stonith-enabled="false" \ last-lrm-refresh="1402826549" rsc_defaults $id="rsc-options" \ resource-stickiness="INFINITY" \ migration-threshold="1" #
■ failcount
failcountをチェック
# crm resource failcount httpd show test1212 scope=status name=fail-count-httpd value=INFINITY
failcountをクリア
# crm resource failcount httpd delete test212
■ Faied actions
Faied actionsを消す
# crm resourtce cleanup httpd test212 Cleaning up httpd on test212 Waiting for 2 replies from the CRMd..