Is there a way or tool which can help route read and write queries to their respective instances in Aurora Postgres cluster, I got to know about ProxySQL but can it be used with Aurora Postgres?
-
Found a solution using Spring's TransactionRoutingDataSource, looks promising but yet to try. Dropping the link here - medium.com/javarevisited/…M Alok– M Alok2024-05-13 07:36:12 +00:00Commented May 13, 2024 at 7:36
-
One more post explaining solution using same TransactionRoutingDataSource - vladmihalcea.com/…M Alok– M Alok2024-05-13 07:46:18 +00:00Commented May 13, 2024 at 7:46
1 Answer
AWS Aurora (postgres or mysql) will provide you the writer and reader endpoint by default when you create a cluster and have atleast one reader and writer nodes. if you have access to the console, click on the database instance -> connectivity & security --> endpoints section , you would see 2 entries, i.e. writer and reader endpoint. And these endpoints remain static when there is a failover or new nodes being added so the applications can use it without changing them in case of underlying nodes changes. Note that in case of multiple reader nodes , the reader endpoint will connect to reader nodes in round robin fashion.
sample doc to refer : https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Connecting.html