views:

196

answers:

3

Hi I have one application running on different servers build in struts2 and deployed in Tomcat5. Now I have a functionality of "Save on All" in this application. When it is called, then the same request parameters need to be passed to all the servlet/action of all the applications running in all the servers. How can this be done?


E.g. I have 5 servers in LAN, each having independent tomcat & mysql. The application is deployed in each tomcat. Now if I upload an image from application running on any server, it should be uploaded to all the servers.

A: 

I'd use something like the Apache HttpClient library. However, beware: depending on your application, a failure on just one of several servers may leave things in a weird state. I'd test this thoroughly if I were you, including by unplugging network cables.

William Pietri
does struts provide any solution to this?
A: 

The solution lies entirely elsewhere. You certainly do not want to solve it at the webinterface level. You need to solve it at the server software level. The application servers needs to run in a clustered environment, all sharing the same data. Here's the Tomcat 5.5 document which describes how to do it: http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html

Similar exist for database servers, but as you didn't mention if and if so which one you're using I can't give a link to detailed documentation how to do it. You now at least know the search keyword "cluster".

Good luck.

BalusC
Then cluster the webservers AND databaseservers.
BalusC
A: 

From your further comments, I think you're going about this entirely the wrong way. If you need an image, don't duplicate it; make a simple service that stores images and call it from your other apps. This is known as a service-oriented architecture. (Under that name, you'll hear a lot of enterprise blah-blah; ignore that, and the SOA products out there. Just make a simple app that lets you POST pictures and GET them again later.)

William Pietri