订阅所有JSP/Servlet的日志 订阅 | 这是最新一篇日志 上一篇 | 下一篇日志 下一篇 ]
Resin

Resin 3.1中集群与负载均衡的实现

附件
resin1.conf(9.3 K)
附件
resin-web.conf(8.8 K)
附件
resin-313-cluster-app-1.gif(6.8 K)
附件
resin-313-cluster-app-2.gif(6.8 K)
附件
resin-313-cluster-web-1.gif(6.3 K)
 
切换到幻灯片模式

需要配置前端web层和后端应用层:

1.web层配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  <!--
     - Configuration for the web-tier/load-balancer
    -->
    <cluster id="web-tier">
      <server-default>
        <!-- The http port -->
        <http address="*" port="80"/>
      </server-default>
 
      <server id="web-a" address="127.0.0.1" port="6700"/>
 
      <cache path="cache" memory-size="64M"/>
 
      <host id="">
        <web-app id="/">
 
           <rewrite-dispatch>
             <load-balance regexp="" cluster="app-tier"/>
           </rewrite-dispatch>
 
        </web-app>
      </host>
    </cluster>
 
<cluster id="app-tier">
  <server id="a" address="127.0.0.1" port="6800"/>
  <server id="b" address="127.0.0.1" port="6801"/>
 
  <persistent-store type="cluster">
    <init path="cluster"/>
  </persistent-store>
 
  <web-app-default>
    <session-config>
      <use-persistent-store/>
    </session-config>
  </web-app-default>
 
  <host id="">
    ...
  </host>
</cluster>


以上配置将来自80的请求分发给app-tier应用层集群处理。

2.应用层集群配置:

1
2
3
    <!-- define the servers in the cluster -->
    <server id="a" address="127.0.0.1" port="6800"/>
    <server id="b" address="127.0.0.1" port="6801"/>


3.启动应用层服务器:
1
2
> D:\resin-pro-3.1.3\httpd.exe -conf conf/resin1.conf -server a
> D:\resin-pro-3.1.3\httpd.exe -conf conf/resin1.conf -server b


以上启动了两个应用服务器a和b.

4.启动前端WEB服务器:
1
> D:\resin-pro-3.1.3\httpd.exe -conf conf/resin-web.conf -server web-a


5.写测试JSP a.jsp:
1
<%System.out.println("aaaaaaaaaaaa");%>


6.在浏览器中访问:

http://localhost/a.jsp

观察一下控制台,会在两个窗口控制台轮流打印出 aaaaaaaaaaaa,说明负载均衡Servlet工作正常。

关掉一个应用服务器,再次访问,会发现访问正常。

平均得分
(0 次评分)





文章来自: 本站原创
标签: Resin 负载均衡 
评论: 52 | 查看次数: 10709
  • 共有 52 条评论
  • 1
  • 2
  • 3
  • 4
  • |
  • >>
yanlink [2010-07-31 14:14:57]
yanlink [2010-06-19 13:44:27]
yanlink [2010-06-18 15:03:45]
xiaoxue00 [2010-06-04 12:14:25]
100% Satisfait Fast & Safe po wow le moins cher l'or du monde, 2 $ = 1000G
Pas cher wow , 100% Fast & Stock complet garantir la sécurité, 24 / 7 Service
wow gold 30% de réduction, 100% satisfait! <15mins rapide des échanges commerciaux s?rs Gold World
songjlvshi [2010-03-29 10:20:01]
beeflee [2009-08-25 14:46:20]
beeflee [2009-08-24 17:53:20]
beeflee [2009-07-31 12:58:54]
beeflee [2009-06-09 12:06:15]
beeflee [2009-05-02 19:04:35]
www.bianyitcm.com
pailiko001 [2009-03-12 09:48:13]
游客 [2009-01-08 14:13:36]
出会い系オンリー出会い-Loversピンクの恋人メル友を探そう不倫人妻秘密サークル素敵な恋人探しご近所の人妻探しメル友ちぇき!不倫ありませんか!セフレPlaySpot女子高生出会い探し人妻がハマる出会い系出会いの森セックスフレンド大陸出会い系サーチご近所のメル友探しセフレステーション出会い系サイトFreedomセフレ伝説セックスフレンド無料サイト-プレミアムスタビLuxuryメル友無料募集サイト素敵なメル友探しご近所のアイシテル!人妻Magic!!プチ家出掲示板NO.1!リターンズ人妻DX出会い探し出会い放題出会い系案内所
游客 [2008-12-05 18:39:18]
游客 [2008-11-18 19:20:01]
游客 [2008-11-01 14:26:49]
  • 共有 52 条评论
  • 1
  • 2
  • 3
  • 4
  • |
  • >>
发表评论
昵 称:  登录
内 容:
选 项:
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启