Spring Data + myBatis + AWS Aurora

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Spring Data + myBatis + AWS Aurora

Ashish Agrawal
Hi,

We are using Spring Data with MyBatis with AWS Aurora (MySQL).
AWS Aurora provides you ability to connect to both a read/write master or read replica to load balance queries.

I was wondering if anyone has advice on how to configure MyBatis to leverage different datasources based on a read or write query.

Thanks for your help,
Ashish

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Spring Data + myBatis + AWS Aurora

Björn Raupach
Hi there,

we are using Aurora but this probably more master-slave in general.

On 11. Jan 2018, at 00:46, Ashish Agrawal <[hidden email]> wrote:

Hi,

We are using Spring Data with MyBatis with AWS Aurora (MySQL).
AWS Aurora provides you ability to connect to both a read/write master or read replica to load balance queries.

Well, you would have to define two different SqlSessionFactories. One that goes to the slave for reading an one that goes to the master for writing. With a JDBC driver all you can do is enter a JDBC Url which doesn’t have any logic that sends statements to this or that database, even if they share the same credentials.


I was wondering if anyone has advice on how to configure MyBatis to leverage different datasources based on a read or write query.

We thought about that, but dismissed it pretty quickly. Apps that require only reading connect to the slave. Apps that read and write go to the master. Makes maintenance much more easier. Imagine your slave is seconds or minutes behind your master. You enter data and it doesn’t show up right away.


Thanks for your help,
Ashish

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.