Use Separate endpoints in dhis2 for database

Dear Team,

We are using RDS Postgres for Dhis2 application in AWS. I want to know is this possible use Separate endpoints for read and write in Dhis2 application?

Thanks

Hi @MohinderS

It looks like this part of the documentation touches upon the subject of you question so I’m wondering if it answers it or if you’re looking there’s a more specific question. Looking forward to seeing your reflection on this: Installation - DHIS2 Documentation

If it’s missing any important information please post back as well. Thanks!

Thanks @Gassim for your response.
I also found this :slight_smile: In the dhis.conf file, you will specify different configurations for the read and write endpoints. DHIS2 uses Hibernate for database interaction, so you need to configure Hibernate properties accordingly.

Example dhis.conf Configuration:

Assume you have the following setup:

  • Master (Write) Database Endpoint: master-db-instance.abcxyz.us-east-1.rds.amazonaws.com
  • Read Replica Database Endpoint: read-replica-db-instance.abcxyz.us-east-1.rds.amazonaws.com

Here’s how you would configure dhis.conf to use these endpoints:

properties

Copy code

# Database settings
connection.url = jdbc:mysql://master-db-instance.abcxyz.us-east-1.rds.amazonaws.com:3306/dhis2
connection.username = your_username
connection.password = your_password

# Additional Hibernate properties
# Specify Hibernate connection properties for read replica
hibernate.connection.url = jdbc:mysql://read-replica-db-instance.abcxyz.us-east-1.rds.amazonaws.com:3306/dhis2
hibernate.connection.username = your_username
hibernate.connection.password = your_password

# Other Hibernate properties
# ...

# Optionally, you may need to adjust other database-related settings in dhis.conf depending on your setup.
1 Like

Awesome, thanks for sharing the configuration that worked for you in your amazonaws instance. I’m pretty sure other community members will benefit from this info. Thanks!

1 Like