Automating the Process
You must have some automation in place to effectively reduce downtimes in case of a region failure. Automation of the process would cut down the cost by expediting the failover process. An automation script can be written that does automation of conducting a cross-region failover in Google Cloud SQL using HA Replicas and Cascading Replicas
- Provide the right GCP Project that the instance resides in
- Instance ID capture of the Primary Instance in the region that is down.
- Instance ID capture of the DR Read Replica that you want to failover to
- Instantiating the failover by promoting the DR Instance in the new region to the primary HA Cloud SQL instance
- Providing the connection details for the newly promoted HA Instance
- Replace the original Primary Instance with an HA Read Replica in the Same Region/Zone for future failovers
How to Use Cloud SQL For MySQL with Automatic Failover on GCP?
Google Cloud Platform (GCP) is a Cloud Service Provider that offers different service models like Iaas(Infrastructure as a service), Paas(Platform as a service), and Saas(Software as a service). Cloud SQL is a relational Database service offered by Google. Users can run MySQL, SQL Server, and PostgreSQL databases on GCP without having the headache of managing the infrastructure. In other words, Cloud SQL is fully managed by Google. Go through GCP account/project creation and Identity and Access Management before moving to this article to have a GCP account and relevant permission in place.