Google Cloud Professional Cloud Database Engineer — Question 122
You are migrating your 2 TB on-premises PostgreSQL cluster to Compute Engine. You want to set up your new environment in an Ubuntu virtual machine instance in Google Cloud and seed the data to a new instance. You need to plan your database migration to ensure minimum downtime. What should you do?
Answer options
- A. 1. Take a full export while the database is offline. 2. Create a bucket in Cloud Storage. 3. Transfer the dump file to the bucket you just created. 4. Import the dump file into the Google Cloud primary server. B.1. Take a full export while the database is offline. 2. Create a bucket in Cloud Storage. 3. Transfer the dump file to the bucket you just created. 4. Restore the backup into the Google Cloud primary server.
- C. 1. Take a full backup while the database is online. 2. Create a bucket in Cloud Storage. 3. Transfer the backup to the bucket you just created. 4. Restore the backup into the Google Cloud primary server. 5. Create a recovery.conf file in the $PG_DATA directory. 6. Stop the source database. 7. Transfer the write ahead logs to the bucket you created before. 8. Start the PostgreSQL service. 9. Wait until Google Cloud primary server syncs with the running primary server.
- D. 1. Take a full export while the database is online. 2. Create a bucket in Cloud Storage. 3. Transfer the dump file and write-ahead logs to the bucket you just created. 4. Restore the dump file into the Google Cloud primary server. 5. Create a recovery.conf file in the $PG_DATA directory. 6. Stop the source database. 7. Transfer the write-ahead logs to the bucket you created before. 8. Start the PostgreSQL service. 9. Wait until the Google Cloud primary server syncs with the running primary server.
Correct answer: C
Explanation
The correct answer is C because it allows for a minimal downtime migration by taking a full backup while the database is online and syncing write-ahead logs. Options A and B require the database to be offline for the export, leading to unnecessary downtime. Option D, while similar, includes steps that would not be effective for minimizing downtime, such as taking an export while the database is online.