AWS rds - How to read from a read replica inside of a Java application?

后端 未结 2 1995
闹比i
闹比i 2021-01-24 13:27

I am new to aws.

I have a mysql rds instance and I just created 2 read replicas. My application is written in Java, and what I have done up until now is using the JDBC

相关标签:
2条回答
  • 2021-01-24 13:54

    AWS suggests setting up route 53. Here is the official article on the subject https://aws.amazon.com/premiumsupport/knowledge-center/requests-rds-read-replicas/

    0 讨论(0)
  • 2021-01-24 13:59

    You can set up an internal Elastic Load Balancer to round robin requests to the slaves. Then configure two connections in your code: one that points directly to the master for writes and one that points to the ELB endpoint for reads.

    Or if you're adventurous, you could set up your own internal load balancer using Nginx, HAProxy, or something similar. In either case, your LB will listen on port 3306.

    0 讨论(0)
提交回复
热议问题