When you deploy a database solution, you should always keep in mind data availability. That's because a disaster event, such as a fire, could destroy the database you have deployed. For this reason, Google Cloud SQL offers high availability for the instances you create. The high availability configuration allows data redundancy in multiple zones inside the region you choose while deploying your DB instance. If you decide to enable high availability, Cloud SQL will set up two DB instances in two different locations with the same region. There will be a principal instance (primary instance or master) that will be mainly used for operations while no issues or problems are detected, and there will be also a second instance (standby instance) that will be only used whether a disaster event happens where the primary instance is deployed. Disks attached to the standby instance is synchronized with the disk attached to the primary instance by using the synchronous replication. This way, if a disaster happens in the location where the primary instance is deployed, data are available in the second zone and the traffic will be routed to the standby instance with minimum downtime. In this lab, you will set up high availability for a Cloud SQL instance, and you will manually simulate a failover to check whether the traffic is automatically routed to the healthy standby instance.
Upon completion of this lab, you will be able to:
This lab is intended for:
Basic knowledge of Cloud SQL is preferred, but it's not required. You can follow the basic Cloud SQL lab following this link.
May 21st, 2025 - Updated lab environment and screenshots to reflect the latest console UI
April 16th, 2025 - Upgraded PostgreSQL DB instance to latest enterprise version and updated screenshots to reflect the latest UI
June 28th, 2023 - Resolved deployment issue
February 14th, 2021 - Clarified the amount of time it takes for the database instance to fully created after starting the lab