Heartbeat 2.1.2 インストール手順例(RHEL4 Update4 x86_64)
Contents
RHEL4 Update4 x86_64版(旧称 EM64T)を開発ツールを含むようにカスタムインストールした環境へのインストール手順例を示します。
RHEL4 が Update5 の場合や i386 の場合でも同様の手順でインストールが可能です。rpmのバージョンは 2.1.2-1 の例になっていますが、2.1.2-2 でも同様の手順になります。
libnet の安定バージョンは、1.1.2.1 で以下の Webページからダウンロードできます。(付録を参照)
・解凍
$ tar zxvf libnet.tar.gz
・コンパイル
$ cd libnet
$ ./configure --prefix=/usr/local 2>&1 \
| tee configure.log
$ make 2>&1 | tee make.log・インストール
$ su # make install 2>&1 | tee make_install.log
# rpm -ivh libgpg-error-devel-1.0-1.x86_64.rpm # rpm -ivh libgcrypt-devel-1.2.0-3.x86_64.rpm # rpm -ivh gnutls-devel-1.0.20-3.2.2.x86_64.rpm
# rpm -ivh beecrypt-devel-3.1.0-6.x86_64.rpm # rpm -ivh elfutils-libelf-devel-0.97.1-3.x86_64.rpm # rpm -ivh elfutils-devel-0.97.1-3.x86_64.rpm # rpm -ivh net-snmp-devel-5.1.2-11.EL4.7.x86_64.rpm # rpm -ivh lm_sensors-devel-2.8.7-2.40.3.x86_64.rpm
次の2つの方法があります。
・rpmパッケージを作成しない一般的なインストール方法
・rpmパッケージを作成し、インストールする方法
・heartbeat用ユーザの作成
インストール時に、ユーザ hacluster が必要となるので、作成しておきます。
$ su -
# groupadd -g 90 haclient
# useradd -u 90 -g haclient -d /home/hacluster \
-s /bin/bash -c HACLUSTER -m haclusterパスワードの設定をおこないます。
# passwd hacluster New UNIX password: ( BAD PASSWORD: it does not contain enough DIFFERENT characters ) Retype new UNIX password: passwd: all authentication tokens updated successfully. # exit $
・解凍
$ tar zxvf heartbeat-2.1.2.tar.gz
・コンパイル
SNMPの有効化とグループID/ユーザIDを指定しています。
$ cd heartbeat-2.1.2
$ ./ConfigureMe configure --enable-snmp_subagent \
--with-group-id=90 --with-ccmuser-id=90 2>&1 | tee configure.log
$ make 2>&1 | tee make.log・インストール
$ su # make install 2>&1 | tee make_install.log
・解凍
$ tar zxvf heartbeat-2.1.2.tar.gz
・rpmパッケージ作成
SNMPの有効化とグループID/ユーザIDを指定してrpmを作成しています。
$ cd heartbeat-2.1.2
$ su
# ./ConfigureMe rpm --enable-snmp_subagent \
--with-group-id=90 --with-ccmuser-id=90 2>&1 | tee configure.log以下の7ファイルが作成されます。(ソフトウェアのダウンロードからダウンロードできるTarballには、debuginfoは含めていません)
/usr/src/redhat/SRPMS/heartbeat-2.1.2-1.src.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-2.1.2-1.x86_64.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-debuginfo-2.1.2-1.x86_64.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-gui-2.1.2-1.x86_64.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-ldirectord-2.1.2-1.x86_64.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-pils-2.1.2-1.x86_64.rpm |
/usr/src/redhat/RPMS/x86_64/heartbeat-stonith-2.1.2-1.x86_64.rpm |
作成された *.rpm は、共通的に使用できるので、configure.log と共に適当な外部メディアにコピーしておくとよいです。
heartbeat の rpm パッケージをインストールすると専用グループ haclient と専用ユーザ hacluster は、自動的に作成されるので、あらかじめ作成しておかなくてもよいですが、 自動的に作成されるユーザ hacluster のホームディレクトリは
となってしまいます。
これを避けるためには、以前のように専用グループ haclient と専用ユーザ hacluster を以下のようにあらかじめ作成しておく方がよいです。
$ su -
# groupadd -g 90 haclient
# useradd -u 90 -g haclient -d /home/hacluster \
-s /bin/bash -c HACLUSTER -m haclusterパスワードの設定をおこないます。
# passwd hacluster New UNIX password: ( BAD PASSWORD: it does not contain enough DIFFERENT characters ) Retype new UNIX password: passwd: all authentication tokens updated successfully.
・インストール
# rpm -ivh heartbeat-pils-2.1.2-1.x86_64.rpm # rpm -ivh heartbeat-stonith-2.1.2-1.x86_64.rpm # rpm -ivh heartbeat-2.1.2-1.x86_64.rpm
また、GUIクライアントを使用する場合は、別サーバにインストールします。 (同じサーバにインストールすることもできます)
# rpm -ivh heartbeat-gui-2.1.2-1.x86_64.rpm
・アンインストール
# rpm -e heartbeat # rpm -e heartbeat-stonith # rpm -e heartbeat-pils
また、GUIクライアントをアンインストールする場合は、
# rpm -e heartbeat-gui
なお、ユーザhacluster とグループ haclient は自動的に削除されないので、別途削除する必要があります。
# userdel hacluster # groupdel haclient ( # rm -r -f /home/hacluster )
RHEL4 Update4 x86_64版がクリーンインストールされた環境へのインストール手順を示します。
RHEL4 Update4 のインストールは、
のどちらでもかまわないです。しかし、カスタムインストールでの「最小インストール」は、 避けた方がよいです。
haertbeat の RHEL4用 rpmは、ソフトウェアのダウンロードページからダウンロードできます。
現時点(2008-07-20 11:09:07)での最新版のバージョンは、2.1.2-2 です。
libnet のインストールは不要です。
「デフォルトのソフトウェアをインストール」を指定してインストールした場合
# rpm -ivh libtool-libs-1.5.6-4.EL4.1.x86_64.rpm
(ES4 Update4 x86_64版のインストール用CD #3 の /RedHat/RPMS/ にあります)
「最小インストール」を指定してインストールした場合 (付録を参照)
heartbeat の rpm パッケージをインストールすると専用グループ haclient と専用ユーザ hacluster は、自動的に作成されるので、あらかじめ作成しておかなくてもよいですが、 自動的に作成されるユーザ hacluster のホームディレクトリは、
となってしまいます。
これを避けるためには、以前のように専用グループ haclient と専用ユーザ hacluster を以下のようにあらかじめ作成しておく方がよいです。
$ su -
# groupadd -g 90 haclient
# useradd -u 90 -g haclient -d /home/hacluster \
-s /bin/bash -c HACLUSTER -m hacluster パスワードの設定をおこないます。
# passwd hacluster New UNIX password: ( BAD PASSWORD: it does not contain enough DIFFERENT characters ) Retype new UNIX password: passwd: all authentication tokens updated successfully.
# rpm -ivh heartbeat-pils-2.1.2-1.x86_64.rpm # rpm -ivh heartbeat-stonith-2.1.2-1.x86_64.rpm # rpm -ivh heartbeat-2.1.2-1.x86_64.rpm
また、GUIクライアントを使用する場合は、別サーバにインストールします。 (同じサーバにインストールすることもできます)
# rpm -ivh heartbeat-gui-2.1.2-1.x86_64.rpm
・アンインストール
# rpm -e heartbeat # rpm -e heartbeat-stonith # rpm -e heartbeat-pils
また、GUIクライアントをアンインストールする場合は、
# rpm -e heartbeat-gui
なお、ユーザhacluster とグループ haclient は自動的に削除されないので、別途削除する必要があります。
# userdel hacluster # groupdel haclient ( # rm -r -f /home/hacluster )
Heartbeat には、バージョン1系互換動作モードとバージョン2動作モードの2つがあります。
バージョン1系互換動作モードは、設定と動作確認が容易にできるので、Heartbeatを始めてさわる人は バージョン1モードの設定と動作確認 に進み実行してみるとよいです。
それ以外の人は、バージョン2モードの設定と動作確認に進んでください。
/etc/ha.d/ha.cf を作成編集します。
例
crm on |
logfile /var/log/ha-log |
logfacility local0 |
keepalive 2 |
deadtime 30 |
warntime 10 |
initdead 60 |
udpport 694 |
auto_failback off |
bcast eth1 |
node sv01 |
node sv02 |
CIB設定ファイル cib.xml を作成編集します。
/var/lib/heartbeat/crm/cib.xml |
例)
ACT,SBY構成で、IPaddrリソースを使用
仮想IPを 172.20.24.30/24 に設定
IPaddrで障害を検知した場合、SBY側にフェイルオーバをおこなう
<cib admin_epoch="0" epoch="1" have_quorum="true" cib_feature_revision="1.3">
<configuration>
<crm_config>
<cluster_property_set id="idCluseterPropertySet">
<attributes>
<nvpair id="symmetric_cluster"
name="symmetric_cluster" value="true"/>
<nvpair id="no_quorum_policy"
name="no_quorum_policy" value="ignore"/>
<nvpair id="stonith_enabled"
name="stonith_enabled" value="false"/>
<nvpair id="short_resource_names"
name="short_resource_names" value="true"/>
<nvpair id="is_managed_default"
name="is_managed_default" value="true"/>
<nvpair id="transition_idle_timeout"
name="transition_idle_timeout" value="120000"/>
<nvpair id="default_resource_stickiness"
name="default_resource_stickiness" value="INFINITY"/>
<nvpair id="stop_orphan_resources"
name="stop_orphan_resources" value="false"/>
<nvpair id="stop_orphan_actions"
name="stop_orphan_actions" value="true"/>
<nvpair id="remove_after_stop"
name="remove_after_stop" value="false"/>
<nvpair id="default_resource_failure_stickiness"
name="default_resource_failure_stickiness" value="0"/>
<nvpair id="stonith_action" name="stonith_action" value="false"/>
</attributes>
</cluster_property_set>
</crm_config>
<nodes/>
<resources>
<group id="grpTest" restart_type="restart">
<primitive id="prmIpTest" class="ocf" type="IPaddr" provider="heartbeat">
<operations>
<op id="ipTest_start"
name="start" timeout="60s" on_fail="fence"/>
<op id="ipTest_monitor"
name="monitor" interval="10s" timeout="5s" on_fail="fence"/>
<op id="ipTest_stop"
name="stop" timeout="60s" on_fail="fence"/>
</operations>
<instance_attributes id="atrIpTest">
<attributes>
<nvpair id="ipTest" name="ip" value="172.20.24.30"/>
<nvpair id="maskTest" name="netmask" value="24"/>
<nvpair id="nicTest" name="nic" value="eth0"/>
</attributes>
</instance_attributes>
</primitive>
</group>
</resources>
<constraints>
</constraints>
</configuration>
<status/>
</cib>
アクセス権と所有者の設定
# chmod 0600 cib.xml # chown hacluster:haclient cib.xml
/etc/ha.d/authkeys を作成編集します。
例
auth 1 |
1 md5 someword |
アクセス権の設定
# chmod 0600 authkeys
手動で heartbeat を起動します。
すべてのサーバでおこなう必要があります。 (例えば稼動系 sv01、待機系 sv02 等)
$ su sv01 # /etc/init.d/heartbeat start Starting High-Availability services: [ OK ] $ su sv02 # /etc/init.d/heartbeat start Starting High-Availability services: [ OK ]
稼動系サーバの仮想IPアドレスの確認
sv01# ifconfig -a eth0:0
:
eth0:0
inet addr: <-仮想IPアドレス
手動で heartbeat を停止します。
すべてのサーバでおこなう必要があります。 (例えば稼動系 sv01、待機系 sv02 等)
$ su sv01# /etc/init.d/heartbeat stop Stopping High-Availability services: [ OK ] $ su sv02# /etc/init.d/heartbeat stop Stopping High-Availability services: [ OK ]
GUIクライアントは、Heartbeat が起動しているサーバでも他のサーバでも動作可能です。
$ /usr/share/heartbeat-gui/haclient.py ( $ /usr/bin/hb_gui でも可 )
GUI画面
注意.RHEL4 Update4 x86_64版を最小インストールした環境では、GUIクライアントは動作しません。他サーバのGUIクライアントからのアクセスは可能です。
参考.RHEL4 Update4 の Python のバージョンは 2.3.4
# rpm -ivh libtool-libs-1.5.6-4.EL4.1.x86_64.rpm # rpm -ivh curl-7.12.1-8.rhel4.x86_64.rpm # rpm -ivh gnutls-1.0.20-3.2.2.x86_64.rpm # rpm -ivh lm_sensors-2.8.7-2.40.3.x86_64.rpm # rpm -ivh perl-Crypt-SSLeay-0.51-5.x86_64.rpm # rpm -ivh perl-Digest-SHA1-2.07-5.x86_64.rpm # rpm -ivh perl-Digest-HMAC-1.01-13.noarch.rpm # rpm -ivh perl-Net-DNS-0.48-1.x86_64.rpm
http://www.packetfactory.net/libnet/ にもし接続できない場合は、 次の Debian の公式パッケージ配布サイトからもダウンロードができます。
http://packages.debian.org/source/etch/libnet
下の方にある Download libnet の libnet_1.1.2.1.orig.tar.gz これが libnet.tar.gz とまったく同一のソースパッケージになります。
バージョン1モードの設定と動作確認, ha.cf, クラスタ情報ベース(CIB), GUIガイド Heartbeat 2.1.3 インストール手順例(RHEL5.1)