LVM
PhysicalVoulumeを登録
fdiskでパーティションを作成する。パーティションのタイプは、Linux LVM(8e)にする。
作成したパーティションのデバイスファイルを指定して
pvcreate <デバイスファイル>
を実行する。
VolumeGroupを作成
Xen
create Domain-U
virt-install \
-r <ram-size> \
-f <install-device> -n <name> \
--os-type=linux \
--os-variant=centos5 \
--location=<os_url> \
--network bridge:xenbr0 \
--vnc
heartbeat
/etc/ha.d/ha.cf
crm yes
# debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
auto_failback off
bcast eth1
node centos01.example.com
node centos02.example.com
haresources から cib.xmlへの変換
# echo "centos01.example.com IPaddr:172.16.253.190 apache" > haresources
# /usr/lib64/heartbeat/haresources2cib.py --stdout haresources > cib.xml
cib.xml
上記cib.xmlを修正する。apacheを使用する場合のcib.xml
<cib admin_epoch="1" epoch="13" num_updates="1" have_quorum="true" ccm_transition="2" num_peers="2" cib_feature_revision="2.0" cib-last-written="Sat Mar 7 00:00:16 2009">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
<attributes>
<nvpair id="cib-bootstrap-options-symmetric-cluster" name="symmetric-cluster" value="true"/>
<nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="stop"/>
<nvpair id="cib-bootstrap-options-default-resource-stickiness" name="default-resource-stickiness" value="0"/>
<nvpair id="cib-bootstrap-options-default-resource-failure-stickiness" name="default-resource-failure-stickiness" value="0"/>
<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
<nvpair id="cib-bootstrap-options-stonith-action" name="stonith-action" value="reboot"/>
<nvpair id="cib-bootstrap-options-startup-fencing" name="startup-fencing" value="true"/>
<nvpair id="cib-bootstrap-options-stop-orphan-resources" name="stop-orphan-resources" value="true"/>
<nvpair id="cib-bootstrap-options-stop-orphan-actions" name="stop-orphan-actions" value="true"/>
<nvpair id="cib-bootstrap-options-remove-after-stop" name="remove-after-stop" value="false"/>
<nvpair id="cib-bootstrap-options-short-resource-names" name="short-resource-names" value="true"/>
<nvpair id="cib-bootstrap-options-transition-idle-timeout" name="transition-idle-timeout" value="5min"/>
<nvpair id="cib-bootstrap-options-default-action-timeout" name="default-action-timeout" value="20s"/>
<nvpair id="cib-bootstrap-options-is-managed-default" name="is-managed-default" value="true"/>
<nvpair id="cib-bootstrap-options-cluster-delay" name="cluster-delay" value="60s"/>
<nvpair id="cib-bootstrap-options-pe-error-series-max" name="pe-error-series-max" value="-1"/>
<nvpair id="cib-bootstrap-options-pe-warn-series-max" name="pe-warn-series-max" value="-1"/>
<nvpair id="cib-bootstrap-options-pe-input-series-max" name="pe-input-series-max" value="-1"/>
<nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="2.1.3-node: 552305612591183b1628baa5bc6e903e0f1e26a3"/>
</attributes>
</cluster_property_set>
</crm_config>
<nodes>
<node id="3aa4b0b5-f0c6-44d5-a71f-d9038c33193e" uname="centos02.in.local" type="normal"/>
<node id="d531c038-de37-4588-90a5-1b496edc3e6b" uname="centos01.in.local" type="normal"/>
</nodes>
<resources>
<group id="group_1">
<primitive class="ocf" id="IPaddr_172_16_253_190" provider="heartbeat" type="IPaddr">
<operations>
<op id="IPaddr_172_16_253_190_mon" interval="5s" name="monitor" timeout="5s"/>
</operations>
<instance_attributes id="IPaddr_172_16_253_190_inst_attr">
<attributes>
<nvpair id="IPaddr_172_16_253_190_attr_0" name="ip" value="172.16.253.190"/>
<nvpair id="IPaddr_172_16_253_190_attr_1" name="netmask" value="24"/>
<nvpair id="IPaddr_172_16_253_190_attr_2" name="nic" value="eth0"/>
</attributes>
</instance_attributes>
</primitive>
<primitive class="ocf" id="apache_2" provider="heartbeat" type="apache">
<operations>
<op id="apache_2_mon" interval="120s" name="monitor" timeout="60s"/>
</operations>
<instance_attributes id="apache_2_inst_attr">
<attributes>
<nvpair id="apache_2_attr_0" name="configfile" value="/etc/[[httpd]]/conf/httpd.conf"/>
<nvpair id="apache_2_attr_1" name="httpd" value="/usr/sbin/httpd"/>
<nvpair id="apache_2_attr_3" name="statusurl" value="http://127.0.0.1/server-status"/>
</attributes>
</instance_attributes>
</primitive>
</group>
</resources>
<constraints>
<rsc_location id="rsc_location_group_1" rsc="group_1">
<rule id="prefered_location_group_1" score="100">
<expression attribute="#uname" id="prefered_location_group_1_expr" operation="eq" value="centos01.example.com"/>
</rule>
</rsc_location>
</constraints>
</configuration>
</cib>
iptables の変更
eth1に入ったパケットを許可する
-A RH-Firewall-1-INPUT -i eth1 -j ACCEPT
httpd.conf
heartbeatから監視するときに、
http://127.0.0.1/server-status
をGETするので、mod_statusを有効にしアクセスを許可する。
LoadModule status_module modules/mod_status.so
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
サービスの有効化
# chkconfig heartbeat on
# service heartbeat start
Designated Controller の表示
# crmadmin -D
Designated Controller is: centos02.example.com
cib.xml の登録
# cibadmin -U -x cib.xml
最終更新:2009年03月10日 01:00