auth 1
1 crc
|
logfile /var/log/ha_log/ha-log.log
logfacility local0
bcast eth1
#ucast eth1 172.16.0.2
keepalive 2
warntime 10
deadtime 30
initdead 120
hopfudge 1
udpport 694
auto_failback on
node ha.server09
node ha.server08
ping 10.0.10.254
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail uid=hacluster gid=haclient
debugfile /var/log/ha_log/ha-debug.log
|
ha.server09 \
IPaddr2::10.0.10.60/24/eth0/10.0.10.255 \
ldirectord::ldirectord.cf LVSSyncDaemonSwap::master
|
# Global Directives
checktimeout=3
checkinterval=1
#fallback=127.0.0.1:80
autoreload=yes
logfile="/var/log/ha_log/ldirectord.log"
logfile="local0"
quiescent=no
# Sample for an http virtual service
virtual=10.0.10.60:80
real=10.0.10.207:80 gate
real=10.0.10.240:80 gate
# real=192.168.6.6:80 gate
fallback=127.0.0.1:80
service=http
request="test.html"
receive="work"
# virtualhost=some.domain.com.au
scheduler=wrr
# persistent=600
#netmask=255.255.255.255
protocol=tcp
checktype=negotiate
|
#!/bin/bash
#
echo -n "Input Virtaul IP:"
read VIP
echo -n "Input Real IP:" #
输入本机
IP
地址
read RIP
/etc/init.d/arptables_jf stop
/sbin/arptables -A IN -d $VIP -j DROP
/sbin/arptables -A OUT -s $VIP -j mangle --mangle-ip-s $RIP
service arptables_jf save
cat >>/etc/sysconfig/network-scripts/ifcfg-lo:0<<EOF
DEVICE=lo:0
IPADDR=$VIP
NETMASK="255.255.255.255"
ONBOOT=yes
NAME=loopback
EOF
/sbin/ifup lo
|
|
#!/bin/sh
# decription:start realserver
# chkconfig 235 26 26
#echo -n "Input Local Real IP:"
#_RIPADD
#echo -n "Input The Vitaul IP(VIP):"
#_VIP
VIP=10.0.10.60
#VIP2=10.0.10.61
RIP1=10.0.10.207
RIP2=10.0.10.208
RIP3=10.0.10.210
RIP4=10.0.10.240
#RIP3=10.0.10.x
GW=10.0.10.254
SER_PORT=80
SMTP_PORT=25
HTTP_CON_INTERFACE=lo:6721
SMTP_CON_INTERFACE=lo:6725
ATTEM=wrr
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig $HTTP_CON_INTERFACE $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev $HTTP_CON_INTERFACE
echo "0" > /proc/sys/net/ipv4/ip_forward
/etc/init.d/arptables_jf stop
/sbin/arptables -A IN -d $VIP -j DROP
/sbin/arptables -A OUT -s $VIP -j mangle --mangle-ip-s $RIP1
/etc/init.d/arptables_jf save
# 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
;;
stop)
/sbin/ifconfig $HTTP_CON_INTERFACE down
echo " stop LVS service"
/sbin/arptables -D IN -d $VIP -j DROP
/sbin/arptables -D OUT -s $VIP -j mangle --mangle-ip-s $RIP1
# echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
# echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
# echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
# echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
|