
Answer-first summary for fast verification
Answer: Check "Lag Bytes" in the monitoring dashboard for the primary instance in the read replica instance. Check the replication status using pg_catalog.pg_last_wal_receive_lsn(). Then, fail over to region 2 by promoting the read replica instance.
To minimize data loss and follow Google-recommended practices after a failure of region 1 where your primary Cloud SQL for PostgreSQL instance is located, the best approach is to promote the read replica in region 2. This is because read replicas in PostgreSQL are designed to be asynchronously updated copies of the primary instance, and promoting a read replica to be the new primary is a supported method for disaster recovery. Before promoting the read replica, it's important to check the replication lag (Lag Bytes) and the replication status using pg_catalog.pg_last_wal_receive_lsn() to ensure that the read replica is as up-to-date as possible. This approach minimizes data loss by utilizing the most recent data available in the read replica. Restoring from automatic backups (options A and B) would result in data loss up to the time of the last backup, which is not ideal for minimizing data loss. Option D suggests checking for automatic failover status, but automatic failover is not a feature for Cloud SQL for PostgreSQL, making this option incorrect.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
How can you restore availability to a Cloud SQL for PostgreSQL instance with a primary in region 1 and a read replica in region 2 after a region 1 failure, while minimizing data loss and adhering to Google's best practices?
A
Restore the Cloud SQL instance from the automatic backups in region 3.
B
Restore the Cloud SQL instance from the automatic backups in another zone in region 1.
C
Check "Lag Bytes" in the monitoring dashboard for the primary instance in the read replica instance. Check the replication status using pg_catalog.pg_last_wal_receive_lsn(). Then, fail over to region 2 by promoting the read replica instance.
D
Check your instance operational log for the automatic failover status. Look for time, type, and status of the operations. If the failover operation is successful, no action is necessary. Otherwise, manually perform gcloud sql instances failover .