Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 2.25 KB

File metadata and controls

60 lines (37 loc) · 2.25 KB

Prepare your Database for Disaster Recovery with Cloud SQL

Let's get started!

This blueprint creates a Cloud SQL instance with multi-region read replicas as described in the Cloud SQL for PostgreSQL disaster recovery article.

The solution is resilient to a regional outage.

To get familiar with the procedure needed in the unfortunate case of a disaster recovery, please follow steps described in part two of the aforementioned article.

This repo is based on the Cloud Foundation Fabric blueprint available here.

Time to complete: About 16 minutes 30 sec.

Click the Start button to move to the next step

Spinning up the architecture

  1. Run the prerequisites script to enable APIs and set Cloud Build permissions.
sh prereq.sh
  1. Run the Cloud Build Job
gcloud builds submit . --config ./build/cloudbuild.yaml

Next we are going to test the architecture and finally clean up your environment.

Testing the architecture

  1. Initiate a failover to test Cloud SQL instance high availability. During this process, the instance will temporarily be unavailable for a few minutes while it switches over.
gcloud sql instances failover INSTANCE_NAME
  1. Verify that the Cloud SQL instance has high availability configuration.
gcloud sql instances describe INSTANCE_NAME

The output should indicate availability Type as REGIONAL. The GceZone and secondary GceZone fields should show the current primary and secondary zones of the instance

Cleaning up your environment

The easiest way to remove all the deployed resources is to run the following command in Cloud Shell:

gcloud builds submit . --config build/cloudbuild_destroy.yaml

The above command will delete the associated resources so there will be no billable charges made afterwards.

Congratulations

You’re all set!