Automatic connection to DB in case of failover

Hi,
We are using camunda 7.12 with Postgres database. In the DB connection string, I am passing two hostnames of both primary and standby DB servers and also passing a parameter targetServerType=primary.

Expectation is that it will connect to only primary database, but instead it is connecting to the first server available. And if that is standby server, it connects to it but the API doesn’t work as the standby is read only DB and cannot upsert in any of the tables.

We are using both hostnames of DB so in case of failover, camunda can automatically connect to the primary server.

Here’s the DB URL format. ConnectionString contains both hosts with port.
"jdbc:postgresql://{{ .Values.postgresql.connectionString }}/{{ required “postgresql.database " .Values.postgresql.database }}?targetServerType=primary”

Any suggestions/pointers on this issue is really appreciated!!..

Thanks!

I would recommend to put load balancer like F5 and configure active/standby at LB level instead of directly mapping at the code level.

1 Like