Legacy configuration for high availability

MySQL  |  PostgreSQL  |  SQL Server

Important: As of January 13, 2025, thelegacy configuration for high availability (HA) is deprecated for all instances.You can't create instances with legacy high availability configuration, and you can'tenable legacy high availability configuration on any existing instances.In addition, after January 13, 2025, legacy high availability instancesare no longer covered by theCloud SQL SLA.

We recommend that youupdate your remaining legacy high availability instances to the current high availability configuration.You can do so by following the instructions inUpdate an instance from legacy to current high availability.Starting on May 1, 2025, Cloud SQL will begin updating anyinstances that use the legacy high availability configuration to use the current regionalpersistent disk-based high availability configuration automatically.

This page describes the legacy configuration for a MySQL instance for high availability (HA).

In a legacy HA configuration,a Cloud SQL for MySQL instance uses a failover replica to add high availability to the instance.This feature isn't available in Google Cloud console. The recommended configuration doesn't usefailover replicas. Instead, the current high availability configuration uses Googleregional persistent disks, which synchronouslyreplicate data at the block-level between two zones in a region.

For more information about the current high availability configuration, seeOverview of the High Availability Configuration.

Update an instance from legacy to current high availability

To update your instance from the legacy to the current high availabilityconfiguration, do the following:

  1. Update your instance to the current high availability configuration.

    1. Delete the failover replica for the MySQL instance you want to update. For more information, seeDisable high availability on an instance.
    2. Configure the primary instance to use the current version of high availability. For more information, seeConfigure an existing instance for high availability.

    As another option, use Database Migration Service tomigrate to an instancethat uses the current high availability configuration.

  2. Create a read replica instance to offload any read workloads that you don't want to perform on the primary instance.

Initiate failover

Testing failover is optional, but is recommended so that you can see how yourapplication responds in the event of a failover.

Note: This feature helps you test your application's response to an automaticfailover. Make sure your instance has completed any previous failover (so it isresponding to connection requests) before you trigger another failover.

To learn more about failovers, see theFailover overview.

gcloud

Initiate the failover:

gcloudsqlinstancesfailoverPRIMARY_INSTANCE_NAME

curl

  1. Describe the primary instance to get the value of thesettingsVersion field.
    gcloudauthloginACCESS_TOKEN="$(gcloudauthprint-access-token)"curl--header"Authorization: Bearer${ACCESS_TOKEN}"\-XGET\https://www.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/PRIMARY_INSTANCE_NAME
  2. Initiate the failover:
    gcloudauthloginACCESS_TOKEN="$(gcloudauthprint-access-token)"curl--header"Authorization: Bearer${ACCESS_TOKEN}"\--header'Content-Type: application/json'\--data'{"failoverContext":{"settingsVersion":"SETTINGS_VERSION"}}'\-XPOST\https://www.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/PRIMARY_INSTANCE_NAME/failover

The instance fails over and is not available to serve data for a few minutes.

Legacy configuration: Create an alert for replication lag

The time required for a failover operation depends on the amount of replicationlag when the failover is initiated. You can use Cloud Monitoring in theGoogle Cloud console to alert you when replication lag exceeds a threshold.

Note: Failover downtime caused by replication lag greater than 1200 seconds isnot counted against the SLA for the instance.

For more information about replication lag, search for "seconds_behind_master"on theSHOW SLAVE STATUS Syntax page in the MySQL documentation.

For more information about Cloud Monitoring, seethe Cloud Monitoring documentation.

Note: A newly created Cloud SQL instance can take time to appear inthe Cloud Monitoring interface. If you don't see a new instance, thencheck again in an hour.

Legacy configuration: Set an alert for a specific failover replica

  1. In the navigation panel of the Google Cloud console,selectMonitoring, and then selectAlerting.
  2. ClickCreate Alerting Policy.
  3. Enter a descriptive name for your alert.
  4. SelectMetric Threshold and clickNext to open the Target tab.
  5. ForResource Type, selectCloud SQL.
  6. ForApplies To, selectSingle, then select your failover replica.
  7. ClickNext to open the Configuration tab.
  8. Enter the following values:

    FieldValue
    If MetricSeconds Behind Master
    Conditionabove
    Thresholds120 (or whatever value is appropriate for your environment)
    For3 minutes

  9. Select yourNotification methods, and clickSave Condition.

Legacy configuration: Set an alert for a group of failover replicas

If you plan to create multiple failover replicas in the same project, it couldbe easier to set the alert for the entire group, rather than on each failoverreplica individually. To create a group for monitoring, use a suffix for thefailover replicas' names, such as "-failover". Make sure you don't use thissuffix for any other types of Cloud SQL instances.

Create your failover replica group:

  1. In the Google Cloud console, go to theMonitoring page.

    Go to Monitoring

  2. From the upper menu bar, selectGroups >Create....
  3. Enter a descriptive name for your group.
  4. LeaveName andContains selected, and enter your name substring.
  5. ClickSave Group. The summary page for the new group opens.
  6. Confirm that the expected instances are included in the group.
Note: If you open theGroups Overview page, where all existing groups arelisted, then your group shows 0 instances. This is because Cloud Monitoringuses the term"instances" to mean VMs and VM clusters. Cloud SQL instances are shownunderResources.

Create the alert for the failover replica group:

  1. In the navigation panel of the Google Cloud console,selectMonitoring, and then selectAlerting.
  2. ClickCreate Alerting Policy.
  3. Enter a descriptive name for your group alert.
  4. SelectMetric Threshold and clickNext to open the Target tab.
  5. ForResource Type, selectCloud SQL.
  6. ForApplies To, selectGroup, then select your failover group.
  7. LeaveAny Member Violates selected and clickNext to open theConfiguration tab.
  8. Enter the following values:

    FieldValue
    If MetricSeconds Behind Master
    Conditionabove
    Thresholds120 (or whatever value is appropriate for your environment)
    For3 minutes

  9. Select your desiredNotification methods, and clickSave Condition.

Legacy configuration: Disable high availability on an instance

You need to delete the failover replica instance to remove high availability from theprimary instance.

Before you perform this procedure, make sure there are no operations currentlyrunning on the primary instance.

To disable high availability:

Console

  1. In the Google Cloud console, go to theCloud SQL Instances page.

    Go to Cloud SQL Instances

  2. Select the failover instance associated with the instance you want to disable high availability on.
  3. On theInstance details page, clickDelete.
  4. In theDelete Replica window, retype the name of failover instance.
  5. ClickDelete. The configuration for the original instance changes to zonal.

gcloud

For reference information, seegcloud sql instances delete.
gcloudsqlinstancesdeleteFAILOVER_REPLICA_NAME

curl

The following request uses theinstances:delete method to delete the instance.
gcloudauthloginACCESS_TOKEN="$(gcloudauthprint-access-token)"curl--header"Authorization: Bearer${ACCESS_TOKEN}"\--header'Content-Type: application/json'\-XDELETE\https://www.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/INSTANCE_NAME

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.