HeartBeatのインストール | Ver.2.1.3 |
# yum install libnet |
# yum install heartbeat # yum install heartbeat |
# cp /usr/share/doc/heartbeat-2.1.3/ha.cf /etc/ha.d/ # cp /usr/share/doc/heartbeat-2.1.3/haresources /etc/ha.d/ # cp /usr/share/doc/heartbeat-2.1.3/authkeys /etc/ha.d/ |
logfile /var/log/ha-log logfacility local0 # 各種監視時間設定 keepalive 2 deadtime 30 warntime 10 initdead 120 # 接続ポート udpport 694 # フェイルオーバー先 ucast eth1 192.168.2.200 # 自動フェイルバック auto_failback on #watchdog /dev/watchdog # uname -nで表示される名前 node sv01.hoge.jp node sv02.hoge.jp # N/W PING死活先 ping 192.168.1.4 # 外部スクリプト respawn root /usr/local/bin/check_active respawn hacluster /usr/lib/heartbeat/ipfail apiauth ipfail gid=haclient uid=hacluster |
sv01.hoge.jp 192.168.1.80/24 httpd |
auth 1 1 crc |
# chmod 600 /etc/ha.d/authkeys # chkconfig --level 345 heartbeat on # /etc/rc.d/init.d/heartbeat start |
#!/bin/bash APACHBINDIR=/usr/local/apache2/bin case "$1" in start) echo -n "Starting httpd: \n" ${APACHBINDIR}/apachectl -k start ;; stop) echo -n "Shutting down http: \n" ${APACHBINDIR}/apachectl -k stop ;; *) esac |
# chmod 777 /etc/init.d/httpd # ln -s /etc/init.d/httpd /etc/rc3.d/httpd |
#!/bin/bash INTERVAL=60 CVIP=192.168.1.80 CURL=/usr/bin/curl GREP=/bin/grep while true do /etc/ha.d/resource.d/IPaddr ${CVIP} status > /dev/null 2>&1 if{ $? -ne 0 } sleep ${INTERVAL} continue fi ${CURL} --retry 4 --retry-delay 15 http://127.0.0.1/server-status/ 2>&1 | \${GREP} 'Apache Server Status for 127.0.0.1' > /dev/null if { $? -ne 0 } /usr/lib/heartbeat/heartbeat -k exit 100 fi sleep $INTERVAL done |
# chmod 755 /usr/local/bin/check_active |
更新 2008.12.06