Linux群集LVS_休闲

1.查看kernel是否支持lvs

modprobe -l |grep ipvs
 

2.在Director Server上安装ipvsadm

yum install ipvsadm -y

3.Director Server 的配置

[root@localhost ~]#ifconfig eth0:0 192.168.60.200 broadcast 192.168.60.200 > netmask 255.255.255.255 up
[root@localhost ~]#route add -host 192.168.60.200 dev eth0:0 
[root@localhost ~]#echo "1" >/proc/sys/net/ipv4/ip_forward
[root@localhost ~]#ipvsadm -C
[root@localhost ~]#ipvsadm -A -t 192.168.60.200:80 -s rr -p 600
[root@localhost ~]#ipvsadm -a -t 192.168.60.200:80 -r 192.168.60.132:80 -g
[root@localhost ~]#ipvsadm -a -t 192.168.60.200:80 -r 192.168.60.144:80 -g
 

4.Real Server 的配置
 [root@localhost ~]#ifconfig lo:0 192.168.1.101 broadcast 192.168.1.101 netmask 255.255.255.255 up
[root@localhost ~]#route add -host 192.168.1.101 dev lo:0
[root@localhost ~]#echo “1″ >/proc/sys/net/ipv4/conf/lo/arp_ignore
[root@localhost ~]#echo “2″ >/proc/sys/net/ipv4/conf/lo/arp_announce
[root@localhost ~]#echo “1″ >/proc/sys/net/ipv4/conf/all/arp_ignore
[root@localhost ~]#echo “2″ >/proc/sys/net/ipv4/conf/all/arp_announce
[root@localhost ~]#sysctl -p