分类: LINUX
2012-05-08 19:40:22
A:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.216 srv1 HA01
10.0.0.216 HA01
10.0.0.217 HA02
192.168.0.217 svr2
B:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.217 srv2 HA02
10.0.0.217 HA02
10.0.0.216 HA01
192.168.0.216 svr1
—————————————
A & B:
vi /etc/rc.local
ipvsadm -A -t 192.168.0.210:80 -s rr
ipvsadm -a -t 192.168.0.210:80 -r 192.168.0.216:80 -m
ipvsadm -a -t 192.168.0.210:80 -r 192.168.0.217:80 -m
yum -y install heartbeat
cd /usr/share/doc/heartbeat-2.1.3/
cp authkeys ha.cf haresources /etc/ha.d/
—————————————
A:
cd /etc/ha.d/
vi authkeys
auth 1
1 crc
chmod 600 authkeys
vi ha.cf
logfile /var/log/ha_log/ha-log.log
bcast eth1
keepalive 2 # 2 seconds or keepalive 100ms
warntime 10
deadtime 30
initdead 120
hopfudge 1
udpport 694
auto_failback on
node svr1
node svr2
ping 192.168.0.1
respawn root /usr/lib/heartbeat/ipfail
apiauth ipfail gid=root uid=root
vi haresources
svr1 IPaddr::192.168.0.210 ipvsadm httpd
B:
cd /etc/ha.d/
vi authkeys
auth 1
1 crc
chmod 600 authkeys
vi ha.cf
logfile /var/log/ha_log/ha-log.log
bcast eth1
keepalive 2
warntime 10
deadtime 30
initdead 120
hopfudge 1
udpport 694
auto_failback on
node svr1
node svr2
ping 192.168.0.1
respawn root /usr/lib/heartbeat/ipfail
apiauth ipfail gid=root uid=root
vi haresources
svr2 IPaddr::192.168.0.210 ipvsadm httpd