Book Image

Implementing Cloud Design Patterns for AWS

Book Image

Implementing Cloud Design Patterns for AWS

Overview of this book

Table of Contents (18 chapters)
Implementing Cloud Design Patterns for AWS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 the command to. The master will receive write commands and the slaves will receive read commands. There are other ways to handle this, and it could be done with other proxy softwares such as HAproxy, or even cluster management tools such as MySQL...