Zonal Failover in Cloud SQL

Zonal failover in Cloud SQL on Google Cloud Platform (GCP), you can simulate the unavailability of a zone and monitor how the system manages the failover process. Cloud SQL ensures high availability (HA) with a regional configuration, where a standby instance located in a different zone is prepared to take over if the primary zone encounters an issue.

Scenario: Zonal Failover in Cloud SQL

Demonstrate how a Cloud SQL instance configured with high availability (HA) fails over to a standby instance in another zone when the primary zone becomes unavailable.

  1. Create a Cloud SQL Instance with High Availability:

    • Go to the Google Cloud Console.

    • Navigate to SQL > Create Instance.

    • Choose the desired database type (e.g., MySQL, PostgreSQL).

  • Choose Cloud SQL edition (Enterprise plus, Enterprise), Preset(Production, Development, and Sandbox).

  • Add Instance Info like Database version(8.0, 8.4), Instance I’d, Password.

  • Choose Region and Zonal Availability( Single zone, Multiple zones for high availability)(e.g., us-central1).

  • The system will automatically configure the instance to have a primary instance in one zone (e.g., us-central1-a) and a standby instance in another zone (e.g., us-central1-b).

  • Add Machine Configuration and Storage.

  • Next click on Create Instance.

  • After 3-4 minutes SQL Instance should be up and running.

  1. Now click on the Failover button .

Cloud SQL will automatically fail over to the stand-by instance present in a different zone in the same region. This is done to validate highly available (multi-zonal) within the same region. In case of a zonal failure, the stand-by instance is promoted to become a primary instance i.e., the instance is us-central1-b becomes a primary instance.

The location has now shifted from us-central-a to us-central-b.

This change occurred because the primary zone has failed over, allowing the secondary zone to take over operations.