Load Balancing For Tomcat

| |
[不指定 2007/08/13 14:39 | by ipaddr ]

要求支持Sticky Session功能,主要有以下几种方案:

1.Apache2.0+Mod_jk 1.x+Tomcat:
http://www.binny.cn/article.asp?id=290
使用mod_jk的stick session功能

2.Apache2.2+mod_proxy+mod_proxy_ajp+mod_proxy_blancer+tomcat
http://myrss.easyjf.com/html/20070711/26929585-1291475.htm
http://www.blogjava.net/thinkbase/archive/2006/10/10/74276.aspx
使用mod_ajp的stick session功能

3.HAProxy
http://haproxy.1wt.eu/
支持AppSession功能
(经鱼漂测试,AppSession好象不起作用)
参考配置:

    listen http_lb1 192.168.3.4:80
       mode    http
       capture request  header Cookie len 200
       # Havind a ServerID cookie on the client allows him to reach
       # the right server even after expiration of the appsession.
       cookie ServerID insert nocache indirect
       # Will memorize 52 bytes of the cookie 'JSESSIONID' and keep them
       # for 3 hours. It will match it in the cookie and the URL field.
       appsession JSESSIONID len 52 timeout 10800000
       server first1 10.3.9.2:10805 check inter 3000 cookie first
       server secon1 10.3.9.3:10805 check inter 3000 cookie secon
       server first1 10.3.9.4:10805 check inter 3000 cookie first
       server secon2 10.3.9.5:10805 check inter 3000 cookie secon
       option httpchk GET /test.jsp

4.Pound
http://www.apsis.ch/pound
支持Session Sticky
官方网站有详细的安装和配置说明
安装:
./configure
make
make install
将安装pound, poundctl在/usr/local/sbin目录

配置(/usr/local/etc/pound.cfg)
Daemon 1
ListenHTTP
 Address 0.0.0.0
 Port    80
End

Service
 BackEnd
  Address 192.168.0.10
  Port    80
 End
 BackEnd
  Address 192.168.0.11
  Port    80
 End
 BackEnd
  Address 192.168.0.12
  Port    80
  Priority 3
 End
 Session
  Type    Cookie
  ID      "JSESSIONID"
  TTL     300
 End
End

Net | 评论(0) | 引用(0) | 阅读(7389)