nerdexam
Google

PROFESSIONAL-CLOUD-DATABASE-ENGINEER · Question #80

You want to migrate your on-premises PostgreSQL database to Compute Engine. You need to migrate this database with the minimum downtime possible. What should you do?

The correct answer is D. Create a hot standby on Compute Engine, and use PgBouncer to switch over the connections. The critical constraint here is the target: Compute Engine (a self-managed VM), not Cloud SQL. Option B describes creating a Cloud SQL read replica and promoting it - this targets Cloud SQL, not Compute Engine, so it's incorrect. Option C (Database Migration Service) primarily…

Migrating Databases

Question

You want to migrate your on-premises PostgreSQL database to Compute Engine. You need to migrate this database with the minimum downtime possible. What should you do?

Options

  • APerform a full backup of your on-premises PostgreSQL, and then, in the migration window,
  • BCreate a read replica on Cloud SQL, and then promote it to a read/write standalone instance.
  • CUse Database Migration Service to migrate your database.
  • DCreate a hot standby on Compute Engine, and use PgBouncer to switch over the connections.

How the community answered

(41 responses)
  • A
    5% (2)
  • B
    7% (3)
  • C
    17% (7)
  • D
    71% (29)

Explanation

The critical constraint here is the target: Compute Engine (a self-managed VM), not Cloud SQL. Option B describes creating a Cloud SQL read replica and promoting it - this targets Cloud SQL, not Compute Engine, so it's incorrect. Option C (Database Migration Service) primarily targets Cloud SQL managed instances, not arbitrary Compute Engine VMs running self-managed PostgreSQL. Option A requires a maintenance window for the cutover, resulting in measurable downtime. Option D is the correct minimum-downtime pattern for self-managed PostgreSQL: configure PostgreSQL streaming replication from the on-premises server to a Compute Engine instance (creating a live hot standby). Once the replica is fully caught up, PgBouncer (a connection pooler/proxy) can redirect application connections to the Compute Engine instance with only a brief pause during the final switchover, minimizing downtime to seconds.

Topics

#Database Migration#PostgreSQL#Compute Engine#High Availability

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DATABASE-ENGINEER Practice