High Availability(HA) on Amazon RDS
-
It is important to have HA architecture in place for database as it is heart of every thing. (If database goes down, everything goes down).
-
Lets evaluate the various architectures of RDS
-
Simplest Architecture: Single AZ Deployment:
- If we need to do some sort of proof of concept or deploy development environments or deploy non critical non production environments, we may not need a HA architecture, as we can live with downtimes.
- Therefore in the previously mentioned scenarios, we can launch the RDS instance in the single AZ.
- With this, you get a single RDS instance inside the vpc with necessary storage as shown below
-
High Availability: Multiple Azs
- If we are trying to run a mission critical database, want to have an architecture where we cannot afford to loose data, have a tight recovery point object or can’t afford much downtime, we must deploy the database in multi-AZ architecture
- When we deploy a database in multi-az architecture, we can choose the AZ’s where we want our primary db instance. RDS will choose the standby instnace & storage in other AZ of the same Region.
- The instance running in the standby will be of same type as your master and storage will be of same configuration & size as primary
- In case of multi-az, primary db is known as master database, handles all the traffic. The stand by database is always kept ready and is in a state that whenever the master goes down, it takes the role of master or primary and supports its application.
- Failover Scenario:
- For example, the host instance can go down & underlying storage can fail, the network connectivity to the primary instance is lost, the AZ itself goes down
- When the failover happens, the standby is automatically propagated to the master and all the application traffic fails over to the new master
- In multi AZ architecture of RDS, the application connects to the Database server using a DNS endpoint that is mapped to the master and standby instances.
- As a result we don’t have to repoin the application to new master or change anything from application side
- RDS automatically does the DNS failover which typically takes 30 to 60 seconds
- Lets create a Multi AZ mysql rds db instance:
- Lets try to connect to the database from mysql workbench as it is publicy accesible (Not recommended for production databases)
