在RedHat EL 4.0 中实现高可用WEB负载均衡群集
2009-04-30 11:08:37 来源:WEB开发网[root @ director heartbeat-2.1.2] # vi /etc/ha.d/authkeys
auth 1
1 crc
# 保存并退出
确保 authkeys 文件仅能由 root 用户读取
[root @ director heartbeat-2.1.2] # chmod 600 /etc/ha.d/authkeys
编辑 /etc/hosts 文件,添加两台机器的名字,做好名字到IP的对应
[root @ director heartbeat-2.1.2] # vi /etc/hosts
192.168.0.160 director
192.168.0.225 bkdirector
注:在备用 director 上也做相同的设置
二、Real Server 配置
1、编辑网络接口
[root @cluser1 root] #vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:0C:29:54:80:3A
IPADDR=192.168.0.249
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
2、编辑 lvs 脚本
[root @cluser1 root] # vi /etc/init.d/lvsrs
#!/bin/bash
VIP=192.168.0.222
case "$1" in
start)
echo "Start Real Server"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
更多精彩
赞助商链接