简体   繁体   English

负载平衡Tomcat 7以进行应用程序部署

[英]Load Balancing Tomcat 7 for Application Deployment

I am serving a java app through apache mod_jk and tomcat 7. I want to be able to deploy a new instance of the application ( on a separate tomcat instance) that will accept all new sessions. 我正在通过apache mod_jk和tomcat 7提供一个Java应用程序。我希望能够部署该应用程序的新实例(在单独的tomcat实例上),该实例将接受所有新会话。 However all existing sessions will continue to be served by the old tomcat. 但是,所有现有的会话将继续由旧的Tomcat服务。 Then after all users have logged off or after a certain time the old server will be shut down and all traffic will be handled by the new tomcat ( I don't expect the load balancer to do this ). 然后,在所有用户注销后或一定时间之后,旧服务器将关闭,所有流量将由新的tomcat处理(我不希望负载均衡器执行此操作)。 This will allow me to deploy without disrupting any connected users. 这将使我能够在不中断任何连接用户的情况下进行部署。

I have read about mod_jk lad balancing which provides the sticky sessions that I need but I have not found how to force all new sessions to be served from the new application. 我已经阅读了有关mod_jk lad平衡的信息,该平衡提供了我需要的粘性会话,但是我还没有找到如何强制从新应用程序提供所有新会话的服务。 It looks simple enough to set up a round robbin, but that is not what i want. 看起来很简单,可以建立一个轮询机制,但这不是我想要的。

So the formal question is: 所以正式的问题是:

Are there any load balancers for tomcat7/apache that will allow me to customize balancing rules to respect sticky sessions but preferentially serve from one node? 是否有任何适用于tomcat7 / apache的负载平衡器,可以让我自定义平衡规则以遵守粘性会话,但优先从一个节点提供服务?

Any thoughts on how to best achieve this? 关于如何最好地实现这一目标的任何想法?

Each node manages it's own session data. 每个节点管理自己的会话数据。 To remove a node with minimal disruptuion to connected users you need to share session data across all nodes. 要以对连接用户的破坏最小的方式删除节点,您需要在所有节点之间共享会话数据。 Tomcat provides session replication for this. Tomcat为此提供了会话复制 Even with replication, it is possilbe that a node may crash before it has shared it's data. 即使进行复制,也可能节点在共享数据之前可能会崩溃。 There are other solutions as dicussed here 还有其他的解决方案dicussed 这里

Tomcat supports running multiple versions of the one web application with the Parallel Deployment feature. Tomcat支持通过并行部署功能运行一个Web应用程序的多个版本。 When a new session is created, it will be using the most recent version of the web application. 创建新会话时,它将使用Web应用程序的最新版本。 Existing sessions will continue to use the version of the web application that was the most recent at the session creation time. 现有会话将继续使用该会话创建时最新的Web应用程序版本。

Here is an article that discusses Parallel Deployment: http://www.objectpartners.com/2012/04/17/tomcat-v7-parallel-deployment/ 这是讨论并行部署的文章: http : //www.objectpartners.com/2012/04/17/tomcat-v7-parallel-deployment/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM