Replication and DR for PCDBE: Bigtable app profiles, AlloyDB backups and Cloud SQL DR replicas

12 min read

Section 4 of the Professional Cloud Database Engineer exam (deploying scalable and highly available databases, ~20%), together with objective 2.3 on backup and objective 1.2 on HA/DR, keeps asking the same kind of question: here are the user locations, the RTO, the RPO and the budget, now pick the right way to replicate and back up the data. This post follows the three newest practice questions in the question bank: Bigtable for users on three continents, AlloyDB with a 6-hour RPO, and Cloud SQL Enterprise Plus that must survive a regional outage. It covers the mechanics, gcloud commands, a decision table and common traps, with example practice questions. For exam format and scope, see the PCDBE study guide; database selection and migration are covered in the database selection and DMS post.

Key takeaways

  • Bigtable for users on several continents: one instance, one cluster per region, and one single-cluster routing app profile per region pointing at the nearest cluster.
  • Single-row transactions (increments, check-and-mutate) can only be enabled with single-cluster routing.
  • AlloyDB continuous backup and recovery is on by default: PITR with microsecond granularity inside a 1–35 day window (default 14), so a few-hour RPO doesn't need more frequent backups.
  • Cloud SQL HA only survives a zone loss; a regional outage needs a cross-region replica. Enterprise Plus adds a DR replica, replica failover and zero-data-loss switchover.

HA, DR and backup: three different layers of protection

The exam likes to blur these three ideas:

  • HA (high availability): keep the database running when a machine or a zone (one data center inside a region) fails. Cloud SQL HA and an AlloyDB primary instance (by default) both have an active node and a standby node in two zones, with automatic failover.
  • DR (disaster recovery): keep serving when the whole region is unavailable. You need a copy of the data in another region: a cross-region replica, a secondary cluster, or a Bigtable cluster in another region.
  • Backup: a copy of the data at a point in time, used when data is corrupted or deleted by mistake. A replica can't help here, because a bad DELETE is replicated almost immediately.

Two numbers drive every choice: RPO (recovery point objective, the maximum data loss you can accept, measured in time) and RTO (recovery time objective, the maximum time until the system works again). An RPO of 6 hours means you may lose at most the last 6 hours of data; an RTO of 4 hours means the application must be back within 4 hours.

Cross-region replication in Cloud SQL, AlloyDB and Bigtable is asynchronous: the primary acknowledges the write first and ships the change afterwards. A replica can fall slightly behind (replication lag), so after a sudden regional outage the RPO is usually above zero.

Bigtable: multi-cluster replication and app profiles

A Bigtable instance holds one or more clusters; each cluster sits in one zone and has its own nodes. As soon as an instance has two or more clusters, Bigtable replicates data between them automatically, and each cluster keeps a separate, full copy. According to the current docs, an instance can have clusters in up to 8 regions, with at most one cluster per zone.

Three properties matter for the exam:

  • Every cluster is a primary: you can read and write in any cluster; there is no read-only replica as in Cloud SQL.
  • Eventual consistency: a write to cluster A shows up in cluster B after a while, typically seconds to minutes, longer if clusters are far apart or overloaded. Reads and writes to the same cluster are consistent.
  • Conflicts: two writes to the same cell (row key, column family, qualifier, timestamp) in two clusters are resolved with "last write wins" based on server-side time.

App profiles: who decides which cluster gets a request

Applications don't call a cluster by name; they send requests with an app profile, which carries a routing policy:

  • Single-cluster routing: all requests go to the one cluster you choose. If it fails, you fail over manually by editing the app profile. This is the only policy that allows single-row transactions.
  • Multi-cluster routing: requests go to the nearest cluster; if it doesn't respond, Bigtable automatically fails over to the nearest available cluster. Variants include cluster groups and row-affinity routing.

Single-row transactions are read-modify-write (increments, appends) and check-and-mutate (conditional writes). They are blocked with multi-cluster routing because two clusters could both run "read then modify" on the same row before replicating to each other, losing an update. If several profiles point at different clusters, disable the feature on the extra profiles.

Users on three continents: why single-cluster routing

The scenario in practice question #188: one global application stores clickstream data in Bigtable, users are in North America, Asia and Europe, and you need lower latency at the lowest cost. The "Examples of replication settings" page describes almost exactly this: one instance with clusters in three distinct geographic regions, an application server near each region, and three app profiles clickstream-us, clickstream-eu, clickstream-asia, each using single-cluster routing to its local cluster.

Why not a single multi-cluster profile? Normally multi-cluster routing also picks the nearest cluster. The problem is failure time: when the Asia cluster is slow or down, multi-cluster routing pushes requests to the US or Europe automatically. Latency jumps because of the distance, and you pay extra inter-region network charges. The docs call multi-cluster routing undesirable for the keep-data-near-users use case for exactly this reason. With single-cluster routing you decide when and where to fail over.

gcloud bigtable instances create clicks \
  --display-name="Clickstream" \
  --cluster-config=id=c-us,zone=us-central1-a \
  --cluster-config=id=c-eu,zone=europe-west1-b \
  --cluster-config=id=c-asia,zone=asia-east1-a

gcloud bigtable app-profiles create clickstream-eu \
  --instance=clicks --route-to=c-eu

To fail over by hand when the Europe cluster has trouble: gcloud bigtable app-profiles update clickstream-eu --instance=clicks --route-to=c-us. If automatic failover matters more than latency, use --route-any.

Cost: extra clusters aren't free

  • Each cluster pays for its own nodes and storage, because each holds a full copy. Three clusters means roughly three times the storage cost.
  • Replication between clusters in the same region is free; replication to another region is charged per destination cluster, based on the data you write. Adding a cluster in a new region also incurs a one-time initial copy charge.
  • Clusters in a replicated instance often need more nodes to handle replication work, plus CPU headroom to absorb another cluster's traffic during failover. The exam likes options with CPU targets for multi-cluster layouts, as in question #13.

"Three separate instances in three regions" costs about the same with no replication at all; "three clusters in one region" saves on network but Asian users still travel a long way.

Bigtable now has two editions, Enterprise and Enterprise Plus; multi-region replication is available in both.

AlloyDB: continuous backup, automated backup and secondary clusters

AlloyDB separates compute from storage; backups and restores run in the storage layer, so they don't slow the cluster down. Three tools, three different problems:

ToolHow it worksUse it when
Continuous backup and recoveryOn by default; keeps logs plus daily incremental backups; PITR with microsecond granularity in a 1–35 day window (default 14)Accidental deletes, corruption from an app bug; near-zero RPO within the region
Automated backupIncremental backups on your schedule (days of week, start hours in UTC), retained by count or by timeYou need copies longer than the PITR window, or "daily backup, keep N days"
On-demand backupFull backup you trigger, kept up to one year, can be stored in another regionBefore a major upgrade, before deleting a cluster, a copy in another region

The scenario in question #190: RTO under 4 hours, RPO 6 hours, daily backups kept for 7 days. Daily backups alone give a worst-case RPO of almost 24 hours (failure just before the next backup), well over 6 hours. Continuous backup closes the gap: you restore to the moment just before the incident. Automated backups cover the "daily, keep 7 days" requirement. So the answer configures both.

gcloud alloydb clusters update prod \
  --region=us-central1 \
  --automated-backup-days-of-week=MONDAY,TUESDAY,\
WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY \
  --automated-backup-start-times=02:00 \
  --automated-backup-retention-period=7d \
  --enable-continuous-backup \
  --continuous-backup-recovery-window-days=7

A restore always creates a new cluster instead of overwriting the old one; you then create a primary instance in it and point the application there:

gcloud alloydb clusters restore prod-restored \
  --region=us-central1 \
  --source-cluster=prod \
  --point-in-time=2026-11-18T01:15:00Z

Restore time depends on data size; with a tight RTO, rehearse to learn the real number.

Key limit: PITR stays in the same region

Both PITR and backup restores create the new cluster in the same region as the source or the backup. If the whole region is lost, continuous backup can't help. Two options:

  • On-demand backups stored in another region: cheap, but the RPO equals the gap between backups and the RTO includes restore time.
  • Cross-region replication: create a secondary cluster in another region (up to five per primary). It replicates continuously and asynchronously, serves reads, and can be promoted to an independent primary when the region fails. Switchover reverses roles with zero data loss for drills or planned region moves; cross-region failover that rebuilds the topology for you is in Preview.
gcloud alloydb clusters create-secondary prod-dr \
  --region=us-east1 \
  --primary-cluster=projects/P/locations/\
us-central1/clusters/prod

gcloud alloydb clusters promote prod-dr \
  --region=us-east1

Backups exist independently of the cluster: you can restore even after the source cluster is deleted. If you need backups nobody can delete, enhanced backups through Backup and DR Service add a backup vault and enforced retention, but per the current comparison table that option has no cross-regional backup.

Cloud SQL: cross-region replicas, DR replica and switchover

Cloud SQL is a regional service. HA puts a primary and a standby in two zones on a shared regional disk, so when a zone fails the standby takes over without losing committed data. But if the whole region goes down, the HA instance goes down with it. The Cloud SQL DR docs are direct: a DR plan needs a cross-region read replica; export/import or restoring a backup in another region also works but takes much longer, especially for large databases.

Basic DR: promote a replica

gcloud sql instances create orders-dr \
  --master-instance-name=orders \
  --region=us-east1

gcloud sql instances promote-replica orders-dr

Promotion turns the replica into a standalone instance and cuts the link to the old primary. In practice you must change connection strings, enable HA on the new instance yourself, create a new replica in a third region, and, when the old region recovers, stop clients from writing to the old primary to avoid split-brain (two primaries taking writes and diverging). Google recommends backing up the new instance right after promotion, before clients write to it.

Enterprise Plus advanced DR

With Cloud SQL Enterprise Plus you designate one cross-region replica as the DR replica (the primary must have PITR enabled). That unlocks two operations:

  • Switchover: a planned role swap with zero data loss, because the primary stays read-only until the DR replica catches up. Use it for regular DR drills and to return to the original region after an incident.
  • Replica failover: for a real regional outage. The DR replica becomes primary immediately; when the old primary comes back it becomes a replica of the new primary automatically, no rebuild needed. Data loss is possible if the replica was lagging.
gcloud sql instances patch orders \
  --failover-dr-replica-name=orders-dr

gcloud sql instances switchover orders-dr

gcloud sql instances promote-replica orders-dr \
  --failover

Instances keep their IP addresses through both operations; with a DNS write endpoint, the endpoint follows the new primary. Size the DR replica like the primary and enable HA on it to reduce RTO.

Low-downtime migration first, then DR

Question #196 combines two needs: migrate on-premises PostgreSQL to Cloud SQL Enterprise Plus with minimal downtime, and survive regional outages. The answer is to configure cross-region replicas and test failover. Spanner is a big change; periodic backups are slow; bigger machines don't replace a copy in another region.

The realistic order when Database Migration Service (DMS) handles the continuous migration:

  1. Run a continuous migration job: full dump, then CDC. Meanwhile the destination is a replica of the source: automated backups and PITR are suspended, and you can't create read replicas from the destination yet.
  2. Cut over (promote the migration job) when lag is near zero, and point the application at Cloud SQL.
  3. Enable automated backups and PITR, create a cross-region replica, and designate the DR replica.
  4. Run a test switchover and switch back, and record the real duration as your reference RTO.

A common real-world mistake: stopping at step 2 and treating HA as enough. At the other end, when the RPO is several days (a test environment), you can enable automated backups and turn off transaction log retention to save cost, as in question #42; when an app bug corrupts data, PITR to a moment before the bug loses the least data (question #25). Cloud SQL PITR also always creates a new instance.

Decision table: from requirement to configuration

Requirement in the questionSensible configurationWhy
Bigtable, users on several continents, low latency, low costOne instance, a cluster per region, a single-cluster app profile per regionNo automatic long-distance rerouting during failures
Bigtable, automatic failover neededMulti-cluster app profile (--route-any)Fails over to the nearest cluster
Bigtable, increments or conditional writesSingle-cluster routing, --transactional-writesMulti-cluster blocks single-row transactions
AlloyDB, RPO of hours, daily backups kept N daysAutomated backup + continuous backupPITR fills the gap between daily copies
AlloyDB, survive a regional outageSecondary cluster in another regionPITR only restores in the same region
Cloud SQL, lose one zoneHA (regional)Standby in another zone, automatic failover
Cloud SQL, lose a region, RTO/RPO in minutesCross-region replica; Enterprise Plus adds a DR replicaFaster than restoring a backup
Cloud SQL, DR drill with no data lossSwitchover with the DR replicaPrimary waits for the replica to catch up
Data deleted or corruptedPITR (Cloud SQL or AlloyDB)Replicas copy the mistake too

Common traps

  • Scenario: Bigtable for users on three continents, picking "one multi-cluster app profile" because it sounds more modern. The docs recommend per-region single-cluster routing for this use case. See question #188.
  • Scenario: three separate Bigtable instances in three regions. Instances don't replicate to each other; automatic sync requires one instance with several clusters.
  • Scenario: AlloyDB with a 6-hour RPO, picking "a longer retention period for automated backups". Longer retention doesn't shorten the RPO; you need continuous backup. See question #190.
  • Scenario: Cloud SQL must "withstand regional outages" and the option only enables HA or picks bigger machines. HA stays inside one region; you need a cross-region replica and a failover test. See question #196.
  • Scenario: using a replica to recover accidentally deleted data. The replica receives the delete almost immediately; use PITR.

Reading the question

  • Users spread across regions + reduce latency with Bigtable: one instance, several clusters, per-region app profiles. Add automatic failover and lean toward multi-cluster routing.
  • RPO shorter than the backup interval: you need PITR or continuous backup. Retention only answers "how long do we keep it".
  • Regional outage, withstand region failure: a copy in another region. Zone failure: HA is enough.
  • Minimal effort: built-in features (DMS, cross-region replicas, continuous backup), not home-grown scripts.
  • Test failover, DR drill: switchover (Cloud SQL Enterprise Plus, AlloyDB) because it loses no data.

Start practicing

Try the 60 free Professional Cloud Database Engineer questions, then a timed exam (Pro). For an overview of the four exam sections, read the PCDBE study guide.

Official sources