Application Datasources for Aurora

0

The marketing of Aurora on all of aws console pages is working.... I've decided to look into Aurora as a replacement for my mySQL database. So I'm just starting to learn about it. I have a question that is talked around in the documentation. But I can't find a precise answer. I understand that there are read-only instances and read/write instances. Obviously, if want to do a simple query, then I should connect to one of the read-only instances. And if I want to do an insert/update/delete type of action, I should connect to the read-write instance. But until now, all of my code has one datasource that connects to 'the' database instance for all SQL calls. Does this mean I have to go into the bowels of my code and now select one of two different datasources depending upon the function of the SQL statement in order to take advantage of the read-only replicas? I 'could' do that in my own code. But I also have several apps other that I don't own. So that is impossible for those apps. Is there any way to just call a single endpoint for all SQL statements and have them route to read-only instances vs. read-write instances based on whether the statement is a query or update? Or do I lose the clustering advantage unless I change the code to route to different endpoints?

Thanks.

Jerry

asked 5 years ago202 views
1 Answer
0

Hi,
it is possible to utilize a 3rd party tool, such as, ProxySQL. You can have a single endoint and define a read/write split based on regex so that the SQL is sent to either the master or to the read replicas.
ProxySQL: https://proxysql.com/#features
Article on creating Read/Write split: https://github.com/sysown/proxysql/wiki/ProxySQL-Read-Write-Split-(HOWTO)
Hope this helps,
-randy

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions