分类: LINUX
2009-02-26 10:15:52
[root@max1 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 max1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.228.225 max1 //主调度器 10.10.10.4 max1 192.168.228.235 max2 //从调度器 10.10.10.5 max2 [root@max1 ~]# VIP 192。168。228。220 RIP1 192。168。228。215 RIP2 192。168。228。242 |
[root@max max]# cat lvs-script #!/bin/sh # # This script willbe executed *after* all the other init scripts. # You can put yourown initialization stuff in here if you don't # want to do thefull Sys V style init stuff. VIP=192.168.228.220 RIP1=192.168.228.215 RIP2=192.168.228.242 /etc/rc.d/init.d/functions case "$1" in start) echo "startLVS of DirectorServer" #Set the Virtual IPAddress /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up /sbin/route add -host $VIP dev eth0:0 #Clear IPVS Table /sbin/ipvsadm -C #Set Lvs /sbin/ipvsadm -A -t$VIP:80 -s rr /sbin/ipvsadm -a -t$VIP:80 -r $RIP1:80 -g /sbin/ipvsadm -a -t$VIP:80 -r $RIP2:80 -g #Run Lvs /sbin/ipvsadm ;; stop) /sbin/ifconfig eth0:0 down echo "closeLVS Directorserver" /sbin/ipvsadm -C ;; *) echo "Usage:$0 {start|stop}" exit 1 esac |
[root@max max]# cat 225.sh #!/bin/bash #description : start realserver VIP=192.168.228.220 /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 sysctl -p #end |
rfhacluster-5.0-3 rfhacluster-monscript-5.0-1 rfhaclustertrek-5.0-1 |