开发者

How to replicate a Java web app onto a 2nd computer for "high availability" and failure tolerance, or "failover"?

开发者 https://www.devze.com 2023-04-13 05:33 出处:网络
I want to be able to upgrade my hardware at any time without interruption in my web app i.e. switch off one of the computers at any time, swap/upgrade it, plug it back in, and set it up so it gets eve

I want to be able to upgrade my hardware at any time without interruption in my web app i.e. switch off one of the computers at any time, swap/upgrade it, plug it back in, and set it up so it gets everything back, including all the changes to disk that happened to the other computer as well, while the wep app continued to run as normal on the other computer. And vice versa.

So basically, I wanna be able to do an across-the-board failover replication of my server.

What is the easiest way of making this happen, and still work properly?

And besides the easiest way, can this also be done at the开发者_如何学编程 web app level, so I can use/try different app servers (Glassfish, JBoss, etc.) for each computer, or must it be the same app server, (e.g. Glassfish+Glassfish, or JBoss+JBoss)? I'm not tied to any app server.


At the very minimum you need to have replication in the application layer - that is the application server, so if this is Tomcat (or something similar) you can read this article as a start. The basic idea is that the HA software would decide to which server to route the request. So in case something happens with srv1 then srv2 will automatically take over. But the most important thing is state-replication that is if you go to srv2 in case srv1 has failed then the users don't have to re-log or loose information. In order to achieve this you can use a shared database for state-related information or use a software, which helps you with this - the main idea behind the latter approach is that memory is replicated across the 2 (or more) instances of the application (in case you don't use a separate, shared database). Check this question (along with the answer) for more information

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号