WEB开发网
开发学院服务器服务器方案 redhatAS4.2 安装集群LVS 阅读

redhatAS4.2 安装集群LVS

 2008-11-26 11:00:32 来源:WEB开发网   
核心提示: 2.修改/etc/ha.d/ldirectord.cf# Global Directiveschecktimeout=3checkinterval=1fallback=127.0.0.1:80autoreload=yeslogfile="/var/log/ldirectord.l

2.修改/etc/ha.d/ldirectord.cf

# Global Directives
checktimeout=3
checkinterval=1
fallback=127.0.0.1:80
autoreload=yes
logfile="/var/log/ldirectord.log"
quiescent=yes
# A sample virual with a fallback that will override the gobal setting
virtual=192.168.0.100:80
    real=192.168.0.126:80 gate
    real=192.168.0.127:80 gate
    real=192.168.0.128:80 gate
    real=192.168.0.25:80 gate
    fallback=127.0.0.1:80  gate
    service=http
    request="test.html"
    receive="Test Page"
    virtualhost=www.funbsd.net
    scheduler=rr
    #persistent=600
    #netmask=255.255.255.255
    protocol=tcp

3、将realserver的启动脚本加入到主节点,和备份节点中,并且这个脚本的启动级必须先于heartbeat,关闭级必须后于heartbeat

chkconfig tunl on 添加到系统启动

4、创建closetunl启动脚本,为启动director server 做准备

more /etc/init.d/closetunl
#!/bin/sh
# create in 200608 ghb
# description: close tunl0 and arp_ignore
VIP=192.168.0.100
. /etc/rc.d/init.d/functions
case "$1" in
  start)
    echo "start director server and close tunl"
    ifconfig tunl0 down
    echo 1 > /proc/sys/net/ipv4/ip_forward
    echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce
    ;;
  stop)
    echo "start Real Server"
    ifconfig tunl0 $VIP netmask 255.255.255.255 broadcast $VIP up
    /sbin/route add -host $VIP dev tunl0
    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
    ;;
  *)
    echo "Usage: lvs {start|stop}"
    exit 1
esac
chmod 755 /etc/init.d/closetunl

5、修改/etc/ha.d/haresources

ns.wdxc.com closetunl 192.168.0.100 tunlvs ldirectord httpd

6、测试

http://192.168.0.100 应该可以轮到四台机器上

配置完毕

总结,上面就是本人在本配置LVS+heartbeat过程,本过程还没涉及到共享存储这块,我觉得集群整套方案,共享存储是相当重要的部分,简易实现通过NFS也可以实现共享存储,但是在要求更大,更快时,可以要考虑其的存储方式如SAN等。还有就是后端数据库之间的负载,同步问题等,本人将在下一步解决关于共享存储,数据库负载方面的问题。也希望大家可以给出一些方案或是想法,大家共同讨论一下,共同学习,共同进步

上一页  4 5 6 7 8 9 

Tags:redhatAS 集群

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接