[英]Load balancing a tomcat application running on two wars
My application (deployed in tomcat) got two wars, a client (say A) and a server (say B). 我的应用程序(部署在tomcat中)经历了两次大战,一个客户端(例如A)和一个服务器(例如B)。 Both of them are deployed in same jvm, and they commnicate via web service.
两者都部署在同一jvm中,并且它们通过Web服务进行通信。 Now in order to make the application scalable, I want this to be clustered and deployed in multiple nodes.
现在,为了使应用程序具有可伸缩性,我希望将其集群化并部署在多个节点中。 Following is the load balancer configuration in apache server.
以下是apache服务器中的负载均衡器配置。
<Proxy balancer://mycluster stickysession=JSESSIONID>
BalancerMember ajp://127.0.0.1:8009 min=10 max=100 route=jvm1 loadfactor=1
BalancerMember ajp://127.0.0.1:8019 min=20 max=200 route=jvm2 loadfactor=1
</Proxy>
ProxyPass /A balancer://mycluster/A
ProxyPass /B balancer://mycluster/B
In my client application, server url is provided like below 在我的客户端应用程序中,服务器网址如下所示
server.url=http://localhost/B/myservice/
My intention is that any request reaching web app A on a node should get processed in web app B on same node. 我的意图是,到达节点上Web应用程序A的任何请求都应在同一节点上的Web应用程序B中得到处理。 But with the current configuration,its not giving intended result.
但是使用当前配置,它并没有给出预期的结果。 Request processed in web app A on jvm1 goes to web app B on jvm2 and vice versa.
在jvm1上的Web应用程序A中处理的请求转到在jvm2上的Web应用程序B,反之亦然。 Please let me know what I'm missing here and how could I get rid of the problem
请让我知道我在这里缺少什么,以及如何摆脱这个问题
The behaviour you observe seems reasonable: You send a request to your Apache load balancer, and it gets routed to one of the nodes. 您观察到的行为似乎是合理的:您向Apache负载均衡器发送了一个请求,该请求被路由到其中一个节点。 If I understand your scenario right, you want to force the request (initiated by your web app) to be routed to the correct node.
如果我了解您的情况正确,那么您想强制将请求(由您的Web应用程序发起)路由到正确的节点。 I can think of two ways to achieve this:
我可以想到两种方法来实现此目的:
BTW: Your configuration looks as if both nodes and the load balancer run on a single machine. 顺便说一句:您的配置看起来好像两个节点和负载平衡器都在一台计算机上运行。 Sure about that?
可以吗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.