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

Database replication pattern


The first pattern we will discuss will cover fault tolerance. To maintain zero-downtime to an end user will be a master-client configuration with full replication of data. It is one thing to have a backup of the actual data, but it is important to be able to continue to serve requests even if the data center hosting the instance experiences issues or upgrades, and causes a termination. Consider another scenario in which the database requires system-level updates that would cause it to not be available.

This could be alleviated by having a separate up-to-date instance in a different availability zone. We will first create our master and prepare it to be a MySQL master instance. Launch an EC2 instance from the AWS Linux AMI and SSH into it when it is ready:

$ sudo yum install -y mysql mysql-server >/dev/null 2>&1
$ sudo sed -i.bak 's/\[mysqld\]/[mysqld]\nlog-bin=mysql-bin\nserver-id=1/g' /etc/my.cnf
$ sudo service mysqld start >/dev/null 2>&1...