这是 apache部分的配置
<Proxy balancer://proxy>
BalancerMember ajp://127.0.0.1:8009/ loadfactor=1 route=tomcat1
BalancerMember ajp://127.0.0.1:8010/ loadfactor=1 route=tomcat2
</Proxy>
<VirtualHost *:80>
ServerName www.a.com
ServerAlias www.a.com
ProxyPass / balancer://proxy/ stickysession=JSESSIONID nofailover=On lbmethod=bytraffic
ProxyPassReverse / balancer://proxy/
</VirtualHost>
Server.xml分别是
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
我在两个的ROOT文件夹下都放一个 test.jsp 分别输出不同的标识.
但刷新的时候,就会发现apache把请求分别发给 tomcat1 tomcat2. stickysession失败了. .这是为什么呢??? 哪位帮忙看看...
===========================================
以下为正确配置
<VirtualHost *:80>
ServerName www.a.com
ServerAlias www.a.com
ProxyPass / balancer://proxy/ stickysession=JSESSIONID
ProxyPassReverse / balancer://proxy/
<Proxy balancer://proxy>
BalancerMember http://192.168.1.192:8080/ loadfactor=1 route=tomcat1
BalancerMember http://192.168.1.192:8081/ loadfactor=2 route=tomcat2
</Proxy>
</VirtualHost>
分享到:
相关推荐
ProxyPass / balancer://csp_cluster/ stickysession=JSESSIONID nofailover=off ProxySet lbmethod=byrequests BalancerMember ajp://192.168.97.57:6080 loadfactor=5 smax=10 min=10 route=csp57 ...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On ``` 这里,`mycluster`是负载平衡器的名称,`t1`和`t2`是Tomcat实例的标识,`http://localhost:8080`和`http://localhost:8081`是Tomcat服务器的...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On ``` - 这里的`BalancerMember`定义了Tomcat集群的成员,`route`参数用于标识每个服务器。 3. 配置Tomcat集群 - 在每台Tomcat服务器的conf/...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName yourdomain.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 这段配置将Apache设置为...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName your.domain.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 这里,`balancer://my...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName your.domain.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 这里创建了一个名...
ProxyPass /app balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse /app balancer://mycluster BalancerMember http://server1:8080/app route=1 BalancerMember ...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 这里的`balancer://mycluster`定义了一个负载均衡器,...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On ``` 这里,`BalancerMember`指定了Tomcat实例的地址和路由标识,`stickysession`则实现了会话持久化。 五、Tomcat6集群配置 1. 配置共享session...
ProxyPass / ajp://localhost:8009/ stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse / ajp://localhost:8009/ ``` 上述配置将所有对"your.domain.com"的请求转发到本地的8009端口(默认...
ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse / balancer://mycluster BalancerMember ajp://localhost:8009 route=v1 BalancerMember ajp://...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName your.domain.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 描述中提到的博客链接...
在集群环境下,Session管理是一个核心问题。用户访问过程中产生的Session数据需要在集群内部共享或者进行一致性处理,以免出现用户状态丢失或不一致的情况。 1. **Session复制(Session Replication)**: - **...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On ``` 这段配置创建了一个名为`mycluster`的负载均衡器,包含了两个成员(`server1`和`server2`),它们分别对应两个Tomcat实例。`stickysession`参数...
ProxyPass / balancer://yourcluster stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse / balancer://yourcluster BalancerMember http://localhost:8080 route=tomcat1 BalancerMember...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName example.com ProxyPass / balancer://mycluster/ ProxyPassReverse / balancer://mycluster/ ``` 5. **测试和监控**:...
ProxySet stickysession=JSESSIONID|jsessionid nofailover=On *:80> ServerName your.domain.com ProxyPass / balancer://mycluster/ ProxyPassReverse / http://your.domain.com/ ``` 在这个配置中,`...
这可以通过在`mod_jk`配置中设置`stickysession`参数来实现。 此外,为了实现更高级的负载均衡策略,如轮询、优先级、响应时间等,可以结合使用其他工具,如Nginx或HAProxy,作为反向代理和负载均衡器,它们可以...
ProxyPass balancer://liveboscluster/lbmethod=byrequests stickysession=JSESSIONID BalancerMember ajp://serverXXXX1:8009 route=lb1 loadfactor=1 BalancerMember ajp://serverXXXX2:8009 route=lb2 ...