免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4255 | 回复: 3
打印 上一主题 下一主题

lvs+heartbeat主备切换问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-19 14:14 |只看该作者 |倒序浏览
目前配置lvs+heartbeat+ldir+ldirectord. 现在遇到问题主lvs down掉网卡后. 备lvs无法接管vip, vip就不通了.

ha.cf配置:
#debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility     local0
keepalive 1
deadtime 10
warntime 10
initdead 15
udpport 694

bcast   eth0                        # Linux
ucast   eth0 10.10.10.4     # 主lvs(10.10.10.3) , 备lvs(10.10.10.4),VIP:10.10.10.2
auto_failback on

node    test01
node    test02

ping 10.10.10.1      #网关

[ 本帖最后由 tech_linux 于 2009-5-19 14:18 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-05-19 14:18 |只看该作者
haresources配置:
test01 dirsrv ldirectord

ldirectord配置:
# Global Directives
checktimeout=3
checkinterval=1
#fallback=127.0.0.1:80
autoreload=yes
#logfile="/var/log/ldirectord.log"
#logfile="local0"
#emailalert="admin@x.y.z"
#emailalertfreq=3600
#emailalertstatus=all
quiescent=no

# Sample for an http virtual service
virtual=10.10.10.2:80
        real=10.10.10.5:80 gate
        real=10.10.10.6:80 gate
#       fallback=127.0.0.1:80 gate
        service=http
        request="healthcheck.html"
        receive="OK"
#       virtualhost=some.domain.com.au
        scheduler=wlc
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp
        checktype=negotiate
        checkport=80
        request="healthcheck.html"
        receive="OK"
#       virtualhost=www.x.y.z

论坛徽章:
0
3 [报告]
发表于 2009-05-19 14:21 |只看该作者
lvs服务dirsrv脚本内容:
#!/bin/bash
#
# description: Start DirectorServer of LVS
# chkconfig: - 08 92
#
# Start LVS DR in Directorserver
VIP=10.10.10.2
RIP1=10.10.10.5
RIP2=10.10.10.6
GW=10.10.10.1
OPTION="wlc"

/etc/rc.d/init.d/functions

case "$1" in
        start)
                echo " Start LVS of DirectorServer"
                # set the Virtual  IP Address
                /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
                /sbin/route add -host $VIP dev eth0:0
                echo "1" >/proc/sys/net/ipv4/ip_forward
               
                #Clear IPVS table 清空ipvs转发表
                /sbin/ipvsadm -C
       
                #Set LVS
                /sbin/ipvsadm -A -t $VIP:80 -s $OPTION -p 3600
                /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)
                echo "Close LVS Directorserver"
                /sbin/ipvsadm -C
                /sbin/ifconfig eth0:0 down
        ;;
        *)
                echo "Usage: $0 {start|stop}"
        exit 1
esac

real服务器realsrv脚本内容:
#!/bin/bash
# description: Start RealServer
# chkconfig: - 08 92
#
VIP=10.10.10.2

/etc/rc.d/init.d/functions

#/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
#/sbin/route add -host $VIP dev lo:0
case $1 in
        start)
                echo " Start RealServer of LVS"
                /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
        ;;
        stop)
                echo "Close RealServer of LVS"
                #/sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 down
                #/sbin/route del -host $VIP
                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
                /sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 down
                #/sbin/route del -host $VIP
        ;;
        status)
                iothere=`/sbin/ifconfig lo:0|grep $VIP`
                iorthere=`/bin/netstat -rn|grep $VIP`
                if [ ! "$iothere" -o ! "$iorthere" ];then
                        echo "BakSrv01 is STOP"
                else
                        echo "BakSrv01 is ALIVE"
                fi
        ;;
        *)
                echo "Usage0 start|stop|status"
        ;;
esac

论坛徽章:
0
4 [报告]
发表于 2009-05-19 14:26 |只看该作者
down掉主外网网卡后,备lvs日志如下:
heartbeat[2295]: 2009/05/19_14:24:23 WARN: node test01: is dead
heartbeat[2295]: 2009/05/19_14:24:23 WARN: No STONITH device configured.
heartbeat[2295]: 2009/05/19_14:24:23 WARN: Shared disks are not protected.
heartbeat[2295]: 2009/05/19_14:24:23 info: Resources being acquired from test01.
heartbeat[2295]: 2009/05/19_14:24:23 info: Link test01:eth0 dead.
harc[2462]:        2009/05/19_14:24:23 info: Running /etc/ha.d/rc.d/status status
mach_down[2493]:        2009/05/19_14:24:23 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
heartbeat[2463]: 2009/05/19_14:24:23 info: Local Resource acquisition completed.
mach_down[2493]:        2009/05/19_14:24:23 info: mach_down takeover complete for node test01.
heartbeat[2295]: 2009/05/19_14:24:23 info: mach_down takeover complete.
harc[2551]:        2009/05/19_14:24:23 info: Running /etc/ha.d/rc.d/ip-request-resp ip-request-resp
ip-request-resp[2551]:        2009/05/19_14:24:24 received ip-request-resp dirsrv OK yes
ResourceManager[2572]:        2009/05/19_14:24:24 info: Acquiring resource group: test02 dirsrv
ResourceManager[2572]:        2009/05/19_14:24:24 info: Running /etc/init.d/dirsrv  start
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP