Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Load Balancing of Datasources in Tomcat

Bron May 7, 2013

Cofluence 3.1 on standalone with Oracle 10g Cluster.

In weblogic there is a multi datasource which from my understanding is load balancing between datasource 1 and datasource 2.

Is there a way to do this in Tomcat?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Ryan Goodwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2013

Hi Bron,

I had a whole paragraph ready for you and then answers went down. SO, now I'm forced to retype what I typed up a couple hours ago before the site went down....

Ok. So what I said previously, was something like this. What I think you want to do is loadbalance apache in front of two tomcat instances that run against separate datasources.

https://confluence.atlassian.com/display/DOC/Apache+and+Tomcat+load+balancing

You'll do this with the mod_proxy and reference them via the workers.properties file in apache as described here:

https://wikis.nyu.edu/display/DOC/Apache+and+Tomcat+load+balancing

This doesn't seem as descriptive as my first response, but let me know if this points you in the right direction.

Hope this helps!

Ryan Goodwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2013

Each instance of tomcat would have a different server.xml with it's unique datasource.

Bron May 8, 2013

Thanks Ryan.

I will try that. I was a little confused because with weblogic, the datasource listed in confluence-cfg.xml file on both nodes is the multi source(load balancing).

Are you saying I just configure datasource 1 in server.xml on node 1 and datasource 2 in server.xml on node 2 and then use the above to load balance between the two?

Thanks

Ryan Goodwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2013

Hi Bron,

Yup, that's exactly what I'm saying. The load balancer should handle.... balancing the load :) between the two tomcat instances. Each TC instance referencing it's own datasource. I'm wondering though, if you're referencing two different datasources, aren't you going to have two different sets of data? Is this a failover mechanism you're trying to put in place so that if you have to you can have database replication and then flip the switch to datasource 2?

Ryan

Bron May 9, 2013

Hi Ryan,

Actually I have two nodes in a cluster with the same data. It is more of a failover mechanism, if one datasource is down it will switch to the other.

Thanks,

Bron

Ryan Goodwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2013

Understood. If that answers the solution for you let us know here!

0 votes
Harry Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2013

Load balancing / failover shouldn't exactly happen at the data source layer. This should be done by the data source itself - virtual IPs, anycast on the dns or any other technical providing transparent load balancer / failover.

This should be independent of Tomcat.

TAGS
AUG Leaders

Atlassian Community Events