Read replica pattern

In the previous database replication pattern, we did a full 1:1 replication of data from the master to a slave, more or less as a backup or failover policy. It might be applicable, however, to use the slave as a read-only instance and use the master as a write or update instance. This would allow us to easily configure multiple replications of the data.

The trick to this one is that it is not subject to traditional load-balancing algorithms. If we configure the slaves as read-only instances, then we cannot allow applications to attempt any write executions. To do this, we will use a software on the master called MySQL proxy with a custom proxy script. This script will inspect the execution and determine what instance to issue ...

Get Implementing Cloud Design Patterns for AWS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.