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

已提问 5 年前208 查看次数
1 回答
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

已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则