Promoting replicas for regional migration or disaster recovery

This page describes how to use cross-region replicas for promoting replicas for regional migration or disaster recovery.

Overview

There are two common scenarios for promoting replicas: regional migration, and disaster recovery. Both involve setting up cross-region replication and then promoting the replica. The main difference between them is whether the promotion of the replica is:

  • Planned (to support a planned migration of a database) or
  • Unplanned (because the primary instance becomes unavailable).

Determining Switch-over Criteria

When the primary instance is stopped, you can check the replication lag in the monitoring dashboard to see whether it meets your switch-over criteria.

Check the Lag Bytes values. When there is a regional outage in the region of the primary instance, Lag Bytes is reported for the primary instance.

Promoting a read replica

Once you determine the switch-over criteria are met, you can promote one of the replicas to a writeable, standalone instance. Consider the following scenario:

  • Region A (us-central1) has a High Availability primary instance (db-a-0)
  • Region B (us-west1) has a replica in a different region (db-b-1)
  • Region C (us-east1) also has a replica in a different region (db-c-1)

You could choose to promote db-b-1 in Region B to become a standalone writable instance.

See Promoting a replica for detailed instructions.

Enabling high availability for the promoted instance

Read replicas are not automatically configured as High Availability (HA) instances when they are promoted. You can enable HA after promoting it, as you would with any non-replica instance. See Enabling and disabling high availability for more information.

Recreating additional replicas

If you promote a replica to become a primary instance, you need to create a new replica if you want to replace it. For example, consider the configuration referenced earlier and repeated here:

  • Region A (us-central1) has a High Availability primary instance (db-a-0)
  • Region B (us-west1) has a replica in a different region (db-b-1)
  • Region C (us-east1) also has a replica in a different region (db-c-1)

If the primary instance (db-a-0) becomes unavailable, you can promote the replica in region B to become the primary. To again have additional replicas in regions A and C, delete the old instances (the former primary instance in A, and the replica in C), and create new read replicas from the new primary instance in B.

The resulting configuration would be:

  • Region A (us-central1) now has a replica (db-a-1)
  • Region B (us-west1) now has the primary instance (db-b-1)
  • Region C (us-east1) now has a new replica (db-c-2)