サーバ構築メモ - heartbeatの設定

heartbeatのインストール

http://linux-ha.org/ja/DownloadSoftware_jaから
heartbeat-2.1.4-1.rhel5.i386.RPMS.tar.gz
をDownloadして展開しておく。

libtool-ltdlとlm_sensorsが必要なのでインストールする。

[root@serv01 ~]# yum -y install libtool-ltdl
[root@serv01 ~]# yum -y install lm_sensors

OpenIPMI-libsとnet-snmpも必要らしいのでインストール。

[root@serv01 ~]# yum -y install OpenIPMI-libs
[root@serv01 ~]# yum -y install net-snmp

heartbeatが動作するユーザーを追加する。

[root@serv01 ~]# groupadd -g 90 haclient 
[root@serv01 ~]# useradd -u 90 -g haclient -d /home/hacluster -s /bin/bash -c HACLUSTER -m hacluster
[root@serv01 ~]# passwd hacluster
Changing password for user hacluster.
New UNIX password: 
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.

インストールする。

[root@serv01 ~]# rpm -ivh pils-2.1.4-1.i386.rpm
[root@serv01 ~]# rpm -ivh stonith-2.1.4-1.i386.rpm
[root@serv01 ~]# rpm -ivh heartbeat-2.1.4-1.i386.rpm 

GUIも欲しいのでインストール。

[root@serv01 ~]# rpm -ivh heartbeat-gui-2.1.4-1.i386.rpm 

heartbeatの設定

ha.cfの作成
[root@serv01 ~]# vi /etc/ha.d/ha.cf
crm on
logfile /var/log/ha-log
keepalive 3
deadtime 30
deadping 40
warntime 10
initdead 60
udpport 694
bcast  eth2
node serv01.yamkazu.org
node serv02.yamkazu.org
auto_failback on
respawn root /usr/lib/heartbeat/pingd -m 100 -d 5s -a default_ping_set

nodeはnodeに参加させるマシンでhostnameコマンドを使って調べる。

authkeysの設定
[root@serv01 ~]# vi /etc/ha.d/authkeys
auth 1
1 md5 someword

[root@serv01 ~]# chmod 0600 /etc/ha.d/authkeys

somewordは適当に変える。