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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access