Application Datasources for Aurora


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?



gefragt vor 5 Jahren236 Aufrufe
1 Antwort

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.
Article on creating Read/Write split:
Hope this helps,

beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen