简体   繁体   中英

Multiple servers for same web application (any a priori configuration needed?)

My goal is to have 2 different tomcat servers that run the same web-application and be using the same DB, I'm using spring + JPA with MySQL DB.

Is this a straight forward practice? can i just deploy and start-up both tomcats? OR - is there any preliminary configuring to do? (ie Do i have to configure JPA in both apps to be synchronized with each other? etc..)

EDIT - we are going to use HA-Proxy as a load balancer.

regards,

The simplest way is to configure your load balancer to point one user always to the same Tomcat instance. Otherwise, if your load balancer will point randomly for each request, you will have problems with sessions. By default one Tomcat won't be able to share session with another. In the other hand, you can configure your Tomcats to replicate sessions between nodes or use common session store. There are at least few ways to do that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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