Chinaunix首页 | 论坛 | 博客
  • 博客访问: 745569
  • 博文数量: 256
  • 博客积分: 3502
  • 博客等级: 中校
  • 技术积分: 3988
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-17 21:13
文章分类

全部博文(256)

文章存档

2014年(11)

2013年(134)

2012年(111)

我的朋友

分类: LINUX

2012-05-08 19:40:22

gateway:192.168.0.1
A:
eth0:192.168.0.216
eth0:0: 192.168.0.210
eth1:10.0.0.216
hostname:svr1
B:
eth0:192.168.0.217
eth0:0: 192.168.0.210
eth1:10.0.0.217
hostname:svr2

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

阅读(981) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~