热部署 Java EAR 以最大限度地减少或消除服务器上应用程序的停机时间? [英] Hot Deploy a Java EAR to Minimize or Eliminate Downtime of an Application on a Server?

查看:25
本文介绍了热部署 Java EAR 以最大限度地减少或消除服务器上应用程序的停机时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说这就是 JavaRebel 所做的,但是有没有其他好的方法来部署新版本的 EAR,同时允许用户在以前的版本上保持活动状态?我们使用 JBoss 作为应用服务器...

I have heard that this is what JavaRebel does but is there any other good way to deploy a new version of an EAR while allowing users to remain active on the previous version? We use JBoss for the application server...

推荐答案

这不是 JavaRebel 所做的.JavaRebel(根据描述)热替换内存中的类.在与系统的现有连接的情况下,这是不可接受的,因为更新的类可能会破坏客户端的逻辑.

It's not what JavaRebel does. JavaRebel (according to description) hot-replaces the classes in memory. It's not acceptable in the case of existing connections to the system, since the updated classes may break the client's logic.

曾经我工作的一家公司遇到了类似的问题,并以这种方式解决了:

Once a company I was working for had a similar problem, and it was solved this way:

  • 智能路由器用作负载平衡器
  • 新版本已部署到(新)集群的 50% 节点
  • 新的连接严格地传递给这些更新的节点,旧的连接在旧节点之间平衡
  • 旧节点离线(一个一个,以保持每个节点的客户端数量在限制内)
  • 同时,新版本被部署到离线的旧"节点,并作为新节点被提升
  • 由于 EJB 集群,会话和 bean 被其他旧节点接收
  • 最终(几个小时后),只剩下一个旧节点,只有一个旧版本的实例,所有使用旧版本的客户端都连接到它
  • 当最后一个旧客户端断开连接时,该节点也被关闭

现在,我不是网络专家,不能给你很多细节(比如路由器硬件是什么等等).我的理解这可以很容易地设置,除非,如果我没记错的话,我们必须设置一个额外的 Weblogic 域来部署应用程序的新版本(否则它会与 JNDI 名称上的旧版本冲突).

Now, I'm not a networking guy, and cannot give you many details (like what was the router hardware and such). My understanding this can be set up pretty easy, except, if I remember right, we had to setup an additional Weblogic domain to deploy new versions of the application (otherwise it would be conflicting with the old one on JNDI names).

希望有所帮助.

附言Ichorus 提供了一条评论,称该应用程序部署在客户端的服务器上.所以路由器技巧可能不可行.现在,我现在只看到一个可行的解决方案(现在是 21:52,我可能会忽略一些事情:))--

P.S. Ichorus provided a comment saying that the app is deployed on clients' servers. So the router trick may be not feasible. Now, I see only one viable solution right now ( it's 21:52 now, I may overlook things :) ) --

  • 使用版本化"JNDI 名称开发新版本;例如如果 Customer bean 在版本 1 中位于 ejb/Customer 下,则在版本 2 中它将位于 ejb/Customer2 下
  • 在应用程序中有一个具有稳定基本接口(工厂风格)的业务外观,当被要求提供 Customer bean 时,它会尝试找到最高版本的 JNDI 名称(当然,不是在每次调用时,都可以缓存一个小时左右).该外观可以(并且应该)作为单独的应用程序部署——并且永远不会或很少更新
  • 现在每个新客户都可以访问最新部署的应用程序,并且应用程序不会发生冲突.

这种方法需要仔细的规划和测试,但恕我直言应该有效.

This approach takes a careful planning and testing, but should work IMHO.

我最近以类似的方式修改了一些应用程序,让它们在同一个域中共存(在它们对不同的数据源使用相同的 JNDI 名称之前).

I recently modified a few applications in a similar way to let them coexist in the same domain (before they used the same JNDI name for different data sources).

这篇关于热部署 Java EAR 以最大限度地减少或消除服务器上应用程序的停机时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆