Question

Difficulty: MediumManaging Storage and Database Solutions

You manage a production Cloud SQL for MySQL instance named `prod-mysql`. To comply with disaster recovery policies, you need to enable point-in-time recovery (PITR) for the instance. On Cloud SQL for MySQL, PITR requires binary logging to be enabled. Which `gcloud` command should you run to enable binary logging on this instance while preserving all existing configurations?

  1. gcloud sql instances patch prod-mysql --enable-bin-logAnswer
  2. B
    gcloud sql instances patch prod-mysql --enable-point-in-time-recovery
  3. C
    gcloud sql backup-runs create --instance=prod-mysql --enable-bin-log
  4. D
    gcloud storage buckets update gs://prod-mysql --enable-versioning

Answer

Execute `gcloud sql instances patch prod-mysql --enable-bin-log` to enable binary logging on the Cloud SQL for MySQL instance.
For Cloud SQL for MySQL instances, point-in-time recovery relies on binary logging. The `gcloud sql instances patch prod-mysql --enable-bin-log` command correctly updates the instance parameters to enable binary logging without modifying other settings.

Step-by-Step Solution

1
Identify the target database engine and operational requirements.
The target instance `prod-mysql` runs Cloud SQL for MySQL, which requires binary logging to support point-in-time recovery (PITR).
Different database engines in Cloud SQL utilize engine-specific flags to control transaction log retention and recovery.
2
Select the correct `gcloud sql` sub-command for configuration modification.
`gcloud sql instances patch` is the standard command for updating specific configuration properties of an existing instance.
`patch` updates only the specified attributes while leaving all other instance configurations untouched.
3
Apply the correct flag for enabling binary logging on MySQL.
The `--enable-bin-log` flag activates MySQL binary logging.
Binary logs record database mutations and allow restoring MySQL databases to a precise point in time.

Key Concept

Cloud SQL Instance Configuration and Backup Management
Rate this question