0

This is my first post in stackoverflow. I am trying to implement read replicas for my DHIS2 instance. I am using DHIS2 version 2.37.9 and Postgres 13. The DB replication works. But read queries are not directed to read replicas.

I tried this config from DHIS2 official documentation.

# Read replica 1 configuration

# Database connection URL, username and password
read1.connection.url = jdbc:postgresql://127.0.0.11/dbread1
read1.connection.username = dhis
read1.connection.password = xxxx

# Read replica 2 configuration

# Database connection URL, username and password
read2.connection.url = jdbc:postgresql://127.0.0.12/dbread2
read2.connection.username = dhis
read2.connection.password = xxxx

# Read replica 3 configuration

# Database connection URL, fallback to master for username and password
read3.connection.url = jdbc:postgresql://127.0.0.13/dbread3

But it did not worked as expected.

From postgresql documentation I found that I can define master and slave in jdbc connection.

jdbc:postgresql://node1,node2,node3/database?targetServerType=master
jdbc:postgresql://node1,node2,node3/database?targetServerType=preferSlave&loadBalanceHosts=true

But that also did not work.

Thanks in advance for your kind help.

0 Answers0