Setting up middleware and database Cluster

Hi
As part of Application scaling, the recent addition of load balancing options looks promising.

While we have the option to have multiple middleware (Application) server as explained here in the developer’s Manual: https://doc.cuba-platform.com/manual-6.5/cluster_mw.html and
https://doc.cuba-platform.com/manual-6.5/cluster_mw_client.html. This is cool,

I want two database servers say DBase1 and DBase2. The Middleware will be connected to DBase1 by default but in case the DBase1 is down, the middleware will be connected to DBase2.

Anything like this?
cuba.connectionUrlList = http://host3:8080/app-core,http://host4:8080/app-core

Thanks for any suggestions.

Hi,
the database connectivity is something that is not part of CUBAs business id say. First question would be how do you setup your database cluster? In case you are talking about master-master replication it is often done via a two-phase commit protocol (at least in the relational space). Then you probably have to do load balancing through DNS.
Normally i would say that if you are not really sure what you are doing and you are running in the cloud you should rely on something like Amazon RDS or equivalent database services instead of servers.
I wrote about this topic in particular in a blog post series on AWS. You might want to have a look at this in particular:
https://www.road-to-cuba-and-beyond.com/cuba-on-aws-ecs-part-2/
Bye
Mario

Hi Mario
Thanks for your reply. I am looking for something simple, the second database server will be say, a backup database service and will be in service once the first server is down. Any simple thoughts? e.g. How can I change the connection string from App server level if the database server can not be connected as it is down …

the simple solution is something like RDS, since you just don’t have to care. You can assume that the RDS DNS “myPostgresRds.amazonaws.com:5432” entry will “always” be available. You don’t ever have to care about replication, asynchronicity, backup, encryption, software updates etc :smiley:

hmmm… but I want something on premise, not on Amazon…

CUBA team, any thoughts?

Hi CUBA team, any thoughts?

Well, in case you cannot benefit from the the economy of scale of cloud offerings, you somehow have to deal with the inherent complexity of the topic. I don’t want to play devil’s advocat at all here, but i think being aware of that this is a major topic will prevent you from having your first data loss because of wrongly configured database backups / replication.

You didn’t tell what DBMS you are planning to use. Taking PostgreSQL as an example, here’s a fairly large part of the document regarding the topic of Chapter 25. High Availability, Load Balancing, and Replication - to get you a first info on the topic. Depending on your requirements it might be a master / master replication or a standby server etc.

Then you might have a look at doing some kind of DNS based HA (for your DB) so you can use a single DNS entry in the tomcats but these DNS entry may point to different DB-IP addresses.

I’m not really an expert on this topic, but that might be a good starting point to dig a little deeper into the topic…

Bye
Mario