UltaMonkey-L7 实现高可用负载均衡测试文档
UltaMonkey-L7 实现高可用负载均衡测试文档
一.UltaMoneky-L7 介绍
负载均衡之UltraMonkey-L7为Ultra Monkeyproject一扩展项目,提供基于特定Url字符集及Session persistence
进行的L7交换负载均衡.通过该架构可非常灵活把各种协议及负载均衡方式有机结合,支持High Availability和负载均衡技术.
二.UltaMonek-L7安装
1下载相关软件包
- wget http://apache.mirror.phpchina.com/apr/apr-1.3.3.tar.gz
- wget http://apache.mirror.phpchina.com/apr/apr-util-1.3.4.tar.bz2
- wgethttp://apache.etoak.com/logging/ ... g4cxx-0.10.0.tar.gz
- wget http://www.packetfactory.net/libnet/dist/libnet.tar.gz
- wget http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2
- wgethttp://sourceforge.jp/projects/u ... ip?use_mirror=jaist
复制代码2.安装相关软件包
Apr安装:
- # tar zxvf apr-1.3.3.tar.gz
- # cd apr-1.3.3.
- # ./configure --prefix=/usr --libdir=/usr/lib
复制代码Apr-tuil安装
- # tar jxvf apr-util-1.3.4.tar.bz2
- # cd apr-util-1.3.4
- # ./configure --prefix=/usr --libdir=/usr/lib --with-apr=/usr
复制代码apache-log4cxx 安装
- # tar zxvf apache-log4cxx-0.10.0.tar.gz
- # cd apache-log4cxx-0.10.0
- # ./configure --prefix=/usr --libdir=/usr/lib
复制代码Libnet安装
- # tar zxvf libnet.tar.gz
- #cd libnet
- # ./configure &&make &&make install
复制代码Heartbeat安装
- # groupadd -g 694 haclient
- # useradd -u 694 -g haclient hacluster
- 复制代码# yum install glib2-devel
- # tar jxvf Heartbeat-STABLE-2-1-STABLE-2.1.4.tar.bz2
- # cd Heartbeat-STABLE-2-1-STABLE-2.1.4
- # ./ConfigureMe configure --disable-swig --disable-snmp-subagent
- # make && make install
- # cp doc/ha.cf doc/haresources doc/authkeys /etc/ha.d/
复制代码ultramonkey-l7-2.0.0-1-rpm 安装
- # unzip ultramonkey-l7-2.0.0-1-rpm.zip
- # cd ultramonkey-l7-2.0.0-1-rpm
- # rpm -Uvh ultramonkey-l7-2.0.0-1.i386.rpm // 用rpm安装ultamonkey.
复制代码三.UltraMonkey-L7配置(NAT)
方案结构:
- virtual= 192.168.1.200:80
- real=192.168.1.204:80 masq 1
- real=192.168.1.205:80 masq 1
- HA-IP(DR):
- LVS Director (Master) 192.168.1.202 primarylb.linuxtone.org
- LVS Director (Backup) 192.168.1.203 backuplb.linuxtone.org
- RealServer: 192.168.1.204 192.168.1.205
复制代码1.配置/etc/hosts
- 192.168.1.202 primarylb.linuxtone.org
- 192.168.1.203 backuplb.linuxtone.org
复制代码2.配置ha.cf
- # vi /etc/ha.d/ha.cf
- logfile/var/log/ha-log
- logfacility
- local0
- keepalive2
- deadtime30
- warntime10
- initdead120
- udpport694
- baud
- 19200
- serial
- /dev/ttyS0
- # Linux
- #ucasteth2 10.0.0.3
- ucast eth0 192.168.1.203
- #备份机上填写ucast eth0192.168.1.202
- auto_failbackon
- watchdog/dev/watchdog
- #crm on
- nodeprimarylb.linuxtone.org
- nodebackuplb.linuxtone.org
- ping192.168.1.203
- #ping_grouplbgroup 10.0.0.1 10.0.0.2
- ping_grouplbgroup 192.168.1.202 192.168.1.203
- respawnroot /usr/lib/heartbeat/ipfail
- apiauth ipfail gid=root uid=root
复制代码3.配置authkeys
- # vi/etc/ha.d/authkeys
复制代码auth 2
2 sha1 Hey!
- #chmod 600 /etc/ha.d/authkeys
复制代码4.配置haresources
主服务器配置:
- # vi /etc/ha.d/haresources
- primarylb.linuxtone.org 192.168.1.200/32/eth0:0 l7vsd l7directord
复制代码备份服务器配置:
- # vi /etc/ha.d/haresources
- backuplb.linuxtone.org 192.168.1.200/32/eth0:0 l7vsd l7directord
复制代码将相关资源建立链接:
- # ln -s /usr/sbin/l7vsd /etc/ha.d/resource.d/
- # ln -s /etc/init.d/l7directord /etc/ha.d/resource.d/
复制代码5.配置l7directord.conf (cat l7directord.cf |grep -v "#")
- # vi /etc/ha.d/conf/l7directord.cf
- checktimeout=4
- checkinterval=10
- autoreload=yes
- logfile="/var/log/l7directord.log"
- quiescent=no
- virtual=192.168.1.200:80
- real=192.168.1.204:80 masq 1
- real=192.168.1.205:80 masq 1
- module=cinsert --cookie-name 'linuxtone'--cookie-expire 5
- scheduler=wrr
- protocol=tcp
- maxconn=2000
复制代码6.配置完成启动heartbeat
# /etc/init.d/heartbeatstart
7. Realserver配置(略,请参考http://www.linuxtone.org 相关文档.)
四. 故障排除与测试.
1.查看日志.
- # tail -f /var/log/messages
复制代码实时监听相看日志变化.
2.查看服务是否正常
- # ps -ef |grepl7directord
- # ps -ef |grepl7vsd
- # ifconfig 或 ip add show
复制代码3. # watch l7vsadm?l
- Layer-7 Virtual Server version 2.0.0-1
- Prot LocalAddressort ProtoMod Scheduler
- -> RemoteAddressort Forward Weight ActiveConn InactConn
- TCP 192.168.1.200:http cinsert wrr
- -> 192.168.1.204:http Masq 1 0 1
- -> 192.168.1.205:http Masq 1 0 0
复制代码4. ha.cf 配置错误导致Heartbeat不能正常停止和接管相关资源[提醒]
在测试过程中在backuplb机器上,配置ha.cf的时候是直接copy了primarylb的配置
文件: ucast eth0 192.168.1.202 写成了ucast eth0 192.168.1.203 导致heartbeat不能正
停止和接管资源。所以朋友们在配置过程中尽量要仔细认真,多分析日志.
五.相关参考文档:
1. 负载均衡之UltraMonkey-L7[龙如俊大哥之作]: http://www.linuxtone.org/thread-1351-1-1.html
2. 官方参考文档: http://ultramonkey-l7.sourceforge.jp/index_en.html
3. PDF文档下载: UltaMonkey-L7 试验文档.pdf (131.88 KB, 下载次数: 144)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论