July 2018
Intermediate to advanced
506 pages
16h 2m
English
In addition to automatic failover, Cloud SQL supports user-initiated failover. This is useful for testing how applications will handle failover in non-production environments, and can be used should Cloud SQL fail to identify issues with the master instance. Let's try this out on our hello-cloud-sql instance. First, enable high availability for the instance with the following command:
gcloud beta sql instances patch hello-cloud-sql \ --availability-type REGIONAL
This operation will take some time to complete as the replica is created and all data is replicated between instances. Once finished, execute the following command to see which zone is currently serving data:
gcloud sql instances describe hello-cloud-sql --format="value(gceZone)" ...