Ngân hàng đề — Google Cloud Professional Cloud Database Engineer

Tìm thấy 169 câu.

Câu 21
Your team uses thousands of connected IoT devices to collect device maintenance data for your oil and gas customers in real time. You want to design inspection routines, device repair, and replacement schedules based on insights gathered from the data produced by these devices. You need a managed solution that is highly scalable, supports a multi-cloud strategy, and offers low latency for these IoT devices. What should you do?
  1. A Use Firestore with Looker.
  2. B Use Cloud Spanner with Data Studio.
  3. C Use MongoD8 Atlas with Charts.
  4. D Use Bigtable with Looker.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi mô tả một tình huống thực tế trong ngành dầu khí (oil and gas): Đội ngũ sử dụng hàng nghìn thiết bị IoT kết nối để thu thập dữ liệu bảo trì thiết bị theo thời gian thực. Mục tiêu là thiết kế lịch kiểm tra, sửa chữa và thay thế thiết bị dựa trên insights từ dữ liệu này. Yêu cầu giải pháp managed (quản lý hoàn toàn), có khả năng mở rộng cao (highly scalable), hỗ trợ chiến lược multi-cloud, và độ trễ thấp (low latency) dành cho các thiết bị IoT.

🛠️ Các yếu tố chính cần xem xét:

  • Dữ liệu IoT: Thường là time-series data (dữ liệu chuỗi thời gian) với volume lớn, cần xử lý real-time.
  • Scalability: Hàng nghìn thiết bị → cần database chịu tải cao (millions of writes/sec).
  • Multi-cloud: Giải pháp phải linh hoạt triển khai trên nhiều cloud provider (AWS, GCP, Azure).
  • Visualization: Kết hợp tool BI để tạo insights (như Looker).
  • Low latency: Phù hợp edge computing hoặc streaming data.

📘 Kiến thức cập nhật (phiên bản GCP 2026): Bigtable là lựa chọn hàng đầu cho IoT telemetry theo tài liệu chính thức GCP (Bigtable v2 với columnar storage tối ưu time-series). Không liên quan AWS trực tiếp, nhưng GCP hỗ trợ hybrid/multi-cloud qua Anthos/ AlloyDB.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Use Bigtable with Looker.
🧩 Lý do:

  • Bigtable là NoSQL wide-column store managed của GCP, siêu scalable (hàng PB dữ liệu, auto-sharding, hỗ trợ >1 triệu QPS), lý tưởng cho IoT real-time data như time-series (ví dụ: thiết bị gửi metrics liên tục). Độ trễ thấp (~ms) nhờ SSD và multi-region replication.
  • Looker (BI tool của GCP) tích hợp native với Bigtable qua BigQuery export hoặc direct connector, giúp visualize insights cho lịch bảo trì.
  • Multi-cloud: Bigtable hỗ trợ qua Google Cloud's multi-cloud integrations (Anthos, Dataplex), và dữ liệu có thể replicate sang AWS S3/Azure via Transfer Service.
  • Phù hợp managed 100%, serverless scaling.
    Nguồn: Cloud Bigtable cho IoT & Looker integrations (cập nhật 2025-2026).

📋 Giải thích tất cả các phương án

  • ❌ [SAI] Use Firestore with Looker.
    Firestore là NoSQL document database, phù hợp app/mobile data nhỏ lẻ, không scalable cao cho hàng nghìn IoT devices (giới hạn 1M writes/sec/cluster, khó handle time-series massive). Độ trễ cao hơn Bigtable cho high-throughput, và kém multi-cloud (chỉ GCP native). Looker tích hợp kém trực tiếp.

  • ❌ [SAI] Use Cloud Spanner with Data Studio.
    Cloud Spanner là relational database global, mạnh consistency cao nhưng chi phí cao và không tối ưu IoT (overkill cho unstructured time-series, throughput thấp hơn Bigtable ~10x). Data Studio (nay là Looker Studio) đã deprecated một phần, không phải best-fit cho real-time insights. Multi-cloud hạn chế.

  • ❌ [SAI] Use MongoD8 Atlas with Charts.
    MongoDB Atlas (managed NoSQL document, multi-cloud thật sự trên AWS/GCP/Azure) scalable tốt, nhưng không phải lựa chọn tối ưu cho IoT time-series cao tải (shard overhead cao, latency cao hơn Bigtable cho sequential writes). Charts là tool viz của MongoDB, kém tích hợp với GCP ecosystem. "MongoD8" có thể typo của MongoDB, nhưng vẫn kém low-latency so với Bigtable.

  • ✅ [ĐÚNG] Use Bigtable with Looker.
    Như giải thích trên: Hoàn hảo match yêu cầu – scalable cực đại cho IoT, low latency, managed, Looker cho insights. Hỗ trợ multi-cloud qua GCP tools.

Tài liệu tham khảo tổng hợp 📘:

Câu 22
Your application follows a microservices architecture and uses a single large Cloud SQL instance, which is starting to have performance issues as your application grows. in the Cloud Monitoring dashboard, the CPU utilization looks normal You want to follow Google-recommended practices to resolve and prevent these performance issues while avoiding any major refactoring. What should you do?
  1. A Use Cloud Spanner instead of Cloud SQL.
  2. B Increase the number of CPUs for your instance.
  3. C Increase the storage size for the instance.
  4. D Use many smaller Cloud SQL instances.
Xem giải thích

🧩 Giải thích chi tiết nội dung câu hỏi

Câu hỏi mô tả một ứng dụng theo kiến trúc microservices đang sử dụng một instance Cloud SQL lớn duy nhất, dẫn đến vấn đề hiệu suất (performance issues) khi ứng dụng mở rộng quy mô. Trong Cloud Monitoring dashboard, chỉ số CPU utilization hiển thị bình thường (không cao). Yêu cầu là áp dụng các best practices được Google khuyến nghị để giải quyết và ngăn ngừa vấn đề này, đồng thời tránh refactoring lớn (không thay đổi code ứng dụng nhiều).

🛠️ Vấn đề cốt lõi: Với microservices, một database lớn chung thường gây bottleneck do connection pooling, I/O contention, hoặc query conflicts giữa các service, dù CPU ổn. Google khuyến nghị shard database theo từng microservice để tăng scalability mà không cần refactor lớn.

📘 Tài liệu tham khảo:

✅ Đáp án đúng: Use many smaller Cloud SQL instances

Lý do chọn đáp án này (theo best practices Google Cloud mới nhất 2026):
Với kiến trúc microservices, Google khuyến nghị mạnh mẽ sử dụng một instance Cloud SQL nhỏ cho mỗi microservice (database-per-service pattern). Điều này:

  • Giải quyết performance issues: Giảm contention trên connections, locks, và I/O khi scale (vì mỗi service chỉ load data cần thiết).
  • Prevent tương lai: Dễ scale độc lập từng instance (vertical/horizontal), hỗ trợ multi-region nếu cần.
  • Tránh major refactoring: Chỉ cần shard data theo service boundary (dùng foreign keys ít hơn, eventual consistency), không thay đổi code app lớn. CPU normal chứng tỏ vấn đề là per-service isolation, không phải compute.
    🧩 Ví dụ: Service A dùng instance SQL-1 (2 vCPU), Service B dùng SQL-2 (4 vCPU) – tự động scale theo workload.

❌ Giải thích tất cả các phương án

  • [SAI] Use Cloud Spanner instead of Cloud SQL.
    ❌ Sai vì: Cloud Spanner là distributed NewSQL cho global scale/high availability, yêu cầu refactoring lớn (chuyển schema sang Spanner model, query language khác, và migrate data phức tạp). Không phù hợp "avoid major refactoring", và vấn đề microservices không cần global consistency ngay. Google chỉ recommend Spanner cho extreme scale (>1TB, global), không phải shard đơn giản.

  • [SAI] Increase the number of CPUs for your instance.
    ❌ Sai vì: Cloud Monitoring cho thấy CPU utilization bình thường, nên tăng CPU chỉ lãng phí chi phí mà không giải quyết gốc rễ (có thể là database locks, high connections, hoặc I/O từ nhiều service). Đây là vertical scaling, không theo best practice microservices (scale-out preferred).

  • [SAI] Increase the storage size for the instance.
    ❌ Sai vì: Tăng storage chỉ ảnh hưởng IOPS/throughput nhẹ nếu dùng SSD, nhưng CPU normal và performance issues từ growth microservices thường do query contention, không phải storage size. Google docs xác nhận storage scale tự động, nhưng không fix multi-tenant DB bottleneck.

  • [ĐÚNG] Use many smaller Cloud SQL instances.
    ✅ Đúng như đã giải thích chi tiết ở trên – Hoàn hảo match Google-recommended sharding pattern cho microservices trên Cloud SQL (dễ manage qua VPC peering/Private Service Connect).

🛠️ Khuyến nghị bổ sung: Sau sharding, monitor Query Insights trong Cloud SQL và dùng Cloud SQL Insights để optimize indexes. Test với read replicas nếu read-heavy!

Câu 23
You need to perform a one-time migration of data from a running Cloud SQL for MySQL instance in the us-central1 region to a new Cloud SQL for MySQL instance in the us-east1 region. You want to follow Google-recommended practices to minimize performance impact on the currently running instance. What should you do?
  1. A Create and run a Dataflow job that uses JdbcIO to copy data from one Cloud SQL instance to another.
  2. B Create two Datastream connection profiles, and use them to create a stream from one Cloud SQL instance to another.
  3. C Create a SQL dump file in Cloud Storage using a temporary instance, and then use that file to import into a new instance.
  4. D Create a CSV file by running the SQL statement SELECT...INTO OUTFILE, copy the file to a Cloud Storage bucket, and import it into a new instance.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi yêu cầu thực hiện di chuyển dữ liệu một lần (one-time migration) từ một instance Cloud SQL for MySQL đang chạy ở vùng us-central1 sang một instance Cloud SQL for MySQL mới ở vùng us-east1. Mục tiêu là tuân thủ best practices được Google khuyến nghị, đồng thời giảm thiểu tác động hiệu suất (minimize performance impact) lên instance nguồn đang hoạt động.

🔍 Các yếu tố chính cần lưu ý:

  • Đây là migration cross-region (giữa các vùng khác nhau), nên cần phương pháp logical (xuất/nhập dữ liệu) thay vì physical replication để tránh độ trễ mạng cao.
  • Phải one-time (không liên tục), nên tránh công cụ streaming/CDC.
  • Instance nguồn đang chạy (running), nên ưu tiên phương pháp không làm gián đoạn hoặc tải nặng (low-impact).
  • Google khuyến nghị sử dụng dump/import qua Cloud Storage cho migration MySQL cross-region, kết hợp temporary instance để giảm tải source.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create a SQL dump file in Cloud Storage using a temporary instance, and then use that file to import into a new instance.

Lý do chọn đáp án này 🛠️:

  • Đây là best practice chính thức của Google cho one-time migration Cloud SQL MySQL cross-region. Sử dụng temporary instance (clone hoặc snapshot từ source) để tạo SQL dump, lưu vào Cloud Storage, sau đó import vào target instance. Phương pháp này hoàn toàn không ảnh hưởng đến source đang chạy (vì dump từ temp instance).
  • Ưu điểm: Hỗ trợ database lớn, schema phức tạp, index; đảm bảo tính nhất quán dữ liệu; chi phí thấp; tự động hóa dễ dàng qua gcloud CLI hoặc Console.
  • Theo tài liệu Google Cloud (cập nhật 2025-2026), đây là cách Database Migration Service (DMS) hoặc manual migration khuyến nghị cho MySQL để minimize downtime/load.

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá đúng ✅ hoặc sai ❌, kèm lý do chi tiết bằng tiếng Việt:

  • ❌ [SAI] Create and run a Dataflow job that uses JdbcIO to copy data from one Cloud SQL instance to another.
    Lý do sai: Dataflow phù hợp cho batch/streaming lớn (như BigQuery ETL), nhưng không phải best practice cho one-time MySQL migration. JdbcIO đọc trực tiếp từ source gây tải cao (high CPU/IOPS) lên instance đang chạy, vi phạm yêu cầu minimize impact. Không hỗ trợ schema/index tốt, dễ lỗi với dữ liệu lớn/cross-region.

  • ❌ [SAI] Create two Datastream connection profiles, and use them to create a stream from one Cloud SQL instance to another.
    Lý do sai: Datastream dành cho continuous CDC (Change Data Capture) replication thời gian thực, không phù hợp one-time migration. Nó tạo stream liên tục, tốn tài nguyên, và không khuyến nghị cho migration đơn lẻ (cross-region có độ trễ cao). Google chỉ dùng Datastream cho ongoing sync, không phải dump one-time.

  • ✅ [ĐÚNG] Create a SQL dump file in Cloud Storage using a temporary instance, and then use that file to import into a new instance.
    Lý do đúng: Như đã giải thích ở trên. Sử dụng temporary instance (tạo từ backup/snapshot source) để dump, tránh tải source. Import qua Cloud Storage nhanh, an toàn. Hỗ trợ mysqldump đầy đủ (schema, data, routine). Đây là Google-recommended cho cross-region MySQL migration.

  • ❌ [SAI] Create a CSV file by running the SQL statement SELECT...INTO OUTFILE, copy the file to a Cloud Storage bucket, and import it into a new instance.
    Lý do sai: SELECT INTO OUTFILE chỉ xuất dữ liệu thô (data only) dưới dạng CSV, không bao gồm schema, index, trigger, view. Giới hạn kích thước file (max 1GB/table mặc định), yêu cầu quyền FILE đặc biệt, và tải nặng trực tiếp lên source. Không phải best practice; Google ưu tiên mysqldump cho migration đầy đủ, an toàn hơn.

📘 Tài liệu tham khảo (cập nhật mới nhất 2026)

  • Google Cloud Documentation: Migrate Cloud SQL using dump and import – Hướng dẫn chính thức dùng temporary instance cho cross-region.
  • Best Practices for Cloud SQL Migration: Database Migration Guide – Khuyến nghị DMS hoặc manual dump cho one-time.
  • Cloud SQL FAQs: Cross-region migration – Xác nhận temporary clone giảm impact.
  • gcloud CLI Reference: gcloud sql import sql và gcloud sql export sql (phiên bản 2026 hỗ trợ parallel dump nhanh hơn).

Hy vọng phân tích này giúp bạn ôn tập hiệu quả! 🚀 Nếu cần demo code gcloud, hãy hỏi thêm.

Câu 24
You are running a mission-critical application on a Cloud SQL for PostgreSQL database with a multi-zonal setup. The primary and read replica instances are in the same region but in different zones. You need to ensure that you split the application load between both instances. What should you do?
  1. A Use Cloud Load Balancing for load balancing between the Cloud SQL primary and read replica instances.
  2. B Use PgBouncer to set up database connection pooling between the Cloud SQL primary and read replica instances.
  3. C Use HTTP(S) Load Balancing for database connection pooling between the Cloud SQL primary and read replica instances.
  4. D Use the Cloud SQL Auth proxy for database connection pooling between the Cloud SQL primary and read replica instances.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi tập trung vào tình huống ứng dụng quan trọng (mission-critical) chạy trên Cloud SQL for PostgreSQL với cấu hình multi-zonal: instance chính (primary) và read replica nằm cùng một region nhưng khác zone nhau. Mục tiêu là phân tải (split the application load) giữa primary (xử lý cả read/write) và read replica (chỉ read), nhằm tăng hiệu suất và độ tin cậy.

🔍 Yêu cầu cốt lõi: Cần giải pháp để route traffic thông minh – writes về primary, reads về replica – mà không làm gián đoạn ứng dụng. Đây là kịch bản phổ biến trong Google Cloud để tận dụng read replicas cho workload read-heavy, đảm bảo high availability (HA) nhờ multi-zone.

📘 Bối cảnh kiến thức GCP (cập nhật đến 2026): Cloud SQL PostgreSQL hỗ trợ read replicas từ phiên bản 13+, với PgBouncer là công cụ khuyến nghị chính thức cho connection pooling và read/write splitting (theo docs GCP Q4/2025).

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Use PgBouncer to set up database connection pooling between the Cloud SQL primary and read replica instances.

Lý do:

  • PgBouncer là connection pooler mã nguồn mở dành riêng cho PostgreSQL, được Google Cloud khuyến nghị triển khai trên Compute Engine hoặc GKE để quản lý kết nối DB hiệu quả.
  • Nó hỗ trợ read/write splitting qua config pool_mode = transaction hoặc session, kết hợp với query_wait_timeout và discovery replicas động (sử dụng SHOW DATABASES hoặc extension như pgbouncer_fdw).
  • Trong multi-zonal setup, PgBouncer giúp giảm latency kết nối, giới hạn số pool per instance (ví dụ: 100 connections/instance), và tự động failover nếu zone outage.
  • Ưu điểm: Scale load reads lên replica mà không thay đổi code app lớn, hỗ trợ HA với health checks. Đây là best practice cho Cloud SQL Postgres theo GCP blueprints (không dùng CLB vì DB protocol phức tạp).

🛠️ Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá dựa trên tính khả thi, hạn chế kỹ thuật và best practices GCP mới nhất:

  • [SAI] Use Cloud Load Balancing for load balancing between the Cloud SQL primary and read replica instances.
    ❌ Sai vì: Cloud Load Balancing (Global/Regional TCP/UDP Proxy LB) chỉ phân tải layer 4 (TCP) ngẫu nhiên, không phân biệt read/write queries (không hiểu PostgreSQL protocol). Sẽ route writes nhầm sang replica (gây lỗi), và không hỗ trợ connection pooling. GCP docs cảnh báo không dùng LB cho Cloud SQL do affinity session và sticky connections thất bại. (Nguồn: Cloud Load Balancing docs).

  • [ĐÚNG] Use PgBouncer to set up database connection pooling between the Cloud SQL primary and read replica instances.
    ✅ Đúng vì: Như giải thích trên, PgBouncer là giải pháp chuẩn cho pooling + splitting trong Cloud SQL Postgres multi-zonal. Hỗ trợ dynamic discovery replicas qua pgbouncer.ini (e.g., read_pool_replicas = primary:100,replica1:200), giảm overhead kết nối 90%+. Triển khai dễ trên VM/GKE với ProxyV5 auth (cập nhật 2025). (Nguồn: Cloud SQL PgBouncer guide).

  • [SAI] Use HTTP(S) Load Balancing for database connection pooling between the Cloud SQL primary and read replica instances.
    ❌ Sai vì: HTTP(S) LB chỉ dành cho web traffic (layer 7), không hỗ trợ PostgreSQL protocol (TCP port 5432). Không có pooling hay read/write routing, sẽ reject connections ngay. GCP không khuyến khích dùng cho DB. (Nguồn: HTTP(S) LB limitations).

  • [SAI] Use the Cloud SQL Auth proxy for database connection pooling between the Cloud SQL primary and read replica instances.
    ❌ Sai vì: Cloud SQL Auth Proxy chỉ lo xác thực IAM/SSL (thay thế IP whitelist), không hỗ trợ pooling, load balancing hay read/write splitting. Nó là sidecar đơn giản, không route traffic thông minh giữa instances. Dùng proxy sẽ tạo single point of failure nếu không HA. (Nguồn: Cloud SQL Proxy docs).

📚 Tài liệu tham khảo chính thức (GCP cập nhật 2026)

Hy vọng phân tích này giúp bạn nắm vững! 🚀 Nếu cần demo config PgBouncer, hãy hỏi thêm.

Câu 25
Your organization deployed a new version of a critical application that uses Cloud SQL for MySQL with high availability (HA) and binary logging enabled to store transactional information. The latest release of the application had an error that caused massive data corruption in your Cloud SQL for MySQL database. You need to minimize data loss. What should you do?
  1. A Open the Google Cloud Console, navigate to SQL > Backups, and select the last version of the automated backup before the corruption.
  2. B Reload the Cloud SQL for MySQL database using the LOAD DATA command to load data from CSV files that were used to initialize the instance.
  3. C Perform a point-in-time recovery of your Cloud SQL for MySQL database, selecting a date and time before the data was corrupted.
  4. D Fail over to the Cloud SQL for MySQL HA instance. Use that instance to recover the transactions that occurred before the corruption.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một tình huống khẩn cấp trong Google Cloud: Tổ chức của bạn đã triển khai phiên bản mới của ứng dụng quan trọng sử dụng Cloud SQL for MySQL với cấu hình high availability (HA) và binary logging được bật để lưu trữ thông tin giao dịch. Phiên bản mới nhất gây lỗi dẫn đến hư hỏng dữ liệu lớn (massive data corruption) trong cơ sở dữ liệu. Nhiệm vụ là giảm thiểu mất mát dữ liệu (minimize data loss) một cách hiệu quả nhất.

🛠️ Bối cảnh kỹ thuật chính:

  • Cloud SQL for MySQL HA: Tạo standby instance để failover, nhưng standby chỉ đồng bộ dữ liệu đến thời điểm gần nhất trước failover.
  • Binary logging enabled: Cho phép Point-in-Time Recovery (PITR), khôi phục đến bất kỳ thời điểm nào trong khoảng thời gian lưu binary log (thường 7 ngày mặc định, có thể cấu hình lên đến 365 ngày theo tài liệu mới nhất 2024-2026).
  • Mục tiêu: Không chỉ khôi phục mà phải minimize data loss, nghĩa là chọn phương pháp gần thời điểm corruption nhất có thể.

📘 Kiến thức cập nhật (phiên bản Google Cloud 2026): Cloud SQL hỗ trợ PITR đầy đủ cho MySQL từ phiên bản 5.7+, với binary log retention lên đến 1 năm, và tích hợp tự động với HA.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Perform a point-in-time recovery of your Cloud SQL for MySQL database, selecting a date and time before the data was corrupted.

Lý do 🏆:

  • Đây là phương pháp tối ưu nhất để minimize data loss vì PITR cho phép khôi phục cơ sở dữ liệu đến thời điểm chính xác ngay trước corruption (ví dụ: 5 phút trước), sử dụng automated backups kết hợp binary logs.
  • Với HA và binary logging enabled, PITR hoạt động liền mạch, tạo instance mới hoặc overwrite instance hiện tại mà không mất dữ liệu sau thời điểm chỉ định.
  • Các phương pháp khác chỉ khôi phục thô (như backup cũ) hoặc không liên quan, dẫn đến mất mát lớn hơn.

🧩 Giải thích tất cả các phương án (đúng/sai)

  • ❌ Open the Google Cloud Console, navigate to SQL > Backups, and select the last version of the automated backup before the corruption.
    Sai vì: Restore từ automated backup chỉ khôi phục đến thời điểm backup gần nhất (thường hàng ngày hoặc theo lịch), có thể mất hàng giờ/gigabyte dữ liệu sau backup đó đến corruption. Không minimize data loss như PITR (binary log cho phép granualar recovery). Backup không hỗ trợ thời điểm chính xác mà không có binary log.

  • ❌ Reload the Cloud SQL for MySQL database using the LOAD DATA command to load data from CSV files that were used to initialize the instance.
    Sai vì: LOAD DATA từ CSV chỉ dùng cho khởi tạo instance ban đầu, không phải recovery từ corruption. Phương pháp này thủ công, chậm, không khôi phục giao dịch gần nhất, và có nguy cơ mất toàn bộ dữ liệu sau init. Hoàn toàn không phù hợp với HA/binary log.

  • ✅ Perform a point-in-time recovery of your Cloud SQL for MySQL database, selecting a date and time before the data was corrupted.
    Đúng vì: Như đã giải thích, PITR sử dụng backup + binary logs để replay transactions đến thời điểm mong muốn, minimize data loss tối đa (có thể chỉ mất vài giây/phút). Hỗ trợ đầy đủ trên Cloud SQL MySQL HA (tài liệu xác nhận PITR retention lên 365 ngày từ 2024).

  • ❌ Fail over to the Cloud SQL for MySQL HA instance. Use that instance to recover the transactions that occurred before the corruption.
    Sai vì: Failover chỉ chuyển sang standby instance (đồng bộ replication lag ~giây), nhưng standby cũng bị ảnh hưởng gián tiếp nếu corruption lan qua replication (dù primary corruption). Không recover được transactions trước corruption một cách chính xác; standby không có PITR riêng mà phải dùng PITR trên primary. Không minimize loss nếu corruption đã sync.

📚 Tài liệu tham khảo (cập nhật 2026)

Hy vọng phân tích này giúp bạn ôn thi chứng chỉ hiệu quả! 🚀 Nếu cần thêm chi tiết, hãy hỏi nhé!

Câu 26 Chọn nhiều đáp án
You plan to use Database Migration Service to migrate data from a PostgreSQL on-premises instance to Cloud SQL. You need to identify the prerequisites for creating and automating the task. What should you do? (Choose two.)
  1. A Drop or disable all users except database administration users.
  2. B Disable all foreign key constraints on the source PostgreSQL database.
  3. C Ensure that all PostgreSQL tables have a primary key.
  4. D Shut down the database before the Data Migration Service task is started.
  5. E Ensure that pglogical is installed on the source PostgreSQL database.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi tập trung vào Google Cloud Database Migration Service (DMS), một dịch vụ của Google Cloud dùng để di chuyển dữ liệu từ cơ sở dữ liệu PostgreSQL on-premises (tại chỗ) sang Cloud SQL (dịch vụ quản lý PostgreSQL/MySQL/SQL Server trên Google Cloud).

📌 Bối cảnh cụ thể: Bạn đang lập kế hoạch sử dụng DMS để tạo và tự động hóa task di chuyển dữ liệu (migration task). Câu hỏi yêu cầu chọn hai điều kiện tiên quyết (prerequisites) cần thiết để đảm bảo quá trình di chuyển diễn ra suôn sẻ, đặc biệt với chế độ continuous migration (di chuyển liên tục, hỗ trợ replication thời gian thực).

🛠️ Mục tiêu chính: Xác định các yêu cầu bắt buộc trên nguồn PostgreSQL để DMS có thể kết nối, đọc dữ liệu và replicate thay đổi một cách chính xác. DMS sử dụng logical replication dựa trên pglogical extension cho PostgreSQL, nên cần cấu hình đặc biệt để tránh lỗi như mất dữ liệu, xung đột khóa ngoại hoặc thiếu chỉ mục.

⚠️ Lưu ý từ tài liệu Google Cloud (cập nhật đến 2026): DMS hỗ trợ PostgreSQL từ version 9.6+, nhưng yêu cầu nghiêm ngặt về primary key và pglogical cho migration đầy đủ. Không liên quan trực tiếp đến AWS DMS (dù đề cập chủ đề AWS ở đầu, nhưng nội dung rõ ràng là GCP Cloud SQL).

✅ Đáp án đúng (Chọn hai)

Hai lựa chọn đúng là:
Ensure that all PostgreSQL tables have a primary key.
Ensure that pglogical is installed on the source PostgreSQL database.

Lý do lựa chọn:
🧩 DMS yêu cầu tất cả bảng trên nguồn PostgreSQL phải có primary key để hỗ trợ logical replication chính xác, tránh lỗi khi replicate INSERT/UPDATE/DELETE (theo cơ chế Change Data Capture - CDC). Không có primary key, DMS không thể theo dõi thay đổi duy nhất trên bảng.
🔧 pglogical là extension bắt buộc trên nguồn PostgreSQL để kích hoạt replication stream, cho phép DMS kết nối và pull dữ liệu liên tục mà không cần downtime lớn. Đây là prerequisites cốt lõi cho task tự động hóa trong DMS (xác nhận từ docs GCP DMS v2.0+ đến 2026).

📋 Giải thích tất cả các phương án

  • Drop or disable all users except database administration users.
    ❌ Sai. Không cần drop hoặc disable user thường; DMS chỉ yêu cầu quyền truy cập replication (REPLICATION role) cho user migration. Việc xóa user có thể gây mất dữ liệu ứng dụng đang chạy, không phải prerequisite. DMS khuyến nghị giữ nguyên quyền để tránh gián đoạn.

  • Disable all foreign key constraints on the source PostgreSQL database.
    ❌ Sai. Không cần disable foreign key; DMS hỗ trợ replicate với constraints đầy đủ nhờ pglogical. Disable có thể dẫn đến dữ liệu không nhất quán ở đích (Cloud SQL). Docs DMS chỉ yêu cầu tạm defer constraints nếu có circular reference, nhưng không bắt buộc toàn bộ.

  • Ensure that all PostgreSQL tables have a primary key.
    ✅ Đúng. Đây là yêu cầu bắt buộc cho logical replication trong DMS. Primary key giúp DMS xác định row duy nhất khi apply thay đổi (replay WAL logs). Nếu thiếu, task sẽ fail với lỗi "no primary key" (theo GCP DMS prerequisites cho PostgreSQL).

  • Shut down the database before the Data Migration Service task is started.
    ❌ Sai. DMS hỗ trợ online migration (không downtime), nên không cần shut down nguồn. Việc tắt DB sẽ gây gián đoạn ứng dụng; DMS chỉ cần kết nối replication slot qua pglogical để capture thay đổi real-time.

  • Ensure that pglogical is installed on the source PostgreSQL database.
    ✅ Đúng. pglogical extension phải được cài đặt và kích hoạt trên nguồn PostgreSQL (version tương thích 10-16) để tạo node/replication set. DMS sử dụng nó làm engine cho continuous job, không có pglogical thì task không khởi động được.

📘 Tài liệu tham khảo (Cập nhật mới nhất 2026)

  • Google Cloud DMS Documentation: Migrate PostgreSQL using DMS – Prerequisites rõ ràng liệt kê primary key và pglogical.
  • Cloud SQL for PostgreSQL Migration Guide: Continuous Migration Setup – Xác nhận không cần shutdown/disable FK.
  • pglogical Official Docs: Installation for Replication – Phiên bản 2.x+ hỗ trợ DMS đến 2026.
  • GCP Release Notes 2025-2026: DMS v2.5 hỗ trợ PostgreSQL 16 với pglogical native integration, không thay đổi prerequisites cốt lõi.

Hy vọng phân tích này giúp bạn ôn thi chứng chỉ hiệu quả! 🚀 Nếu cần ví dụ config, hãy hỏi thêm.

Câu 27
You are using Compute Engine on Google Cloud and your data center to manage a set of MySQL databases in a hybrid configuration. You need to create replicas to scale reads and to offload part of the management operation. What should you do?
  1. A Use external server replication.
  2. B Use Data Migration Service.
  3. C Use Cloud SQL for MySQL external replica.
  4. D Use the mysqldump utility and binary logs.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm

📖 Nội dung câu hỏi:
Câu hỏi mô tả tình huống bạn đang sử dụng Compute Engine trên Google Cloud kết hợp với data center (on-premises) để quản lý một bộ cơ sở dữ liệu MySQL trong cấu hình hybrid (lai giữa cloud và on-prem). Yêu cầu là tạo replicas để:

  • Scale reads (mở rộng khả năng đọc dữ liệu, giảm tải cho primary database).
  • Offload part of the management operation (chuyển một phần công việc quản lý sang nơi khác, giảm gánh nặng vận hành).

Đây là kịch bản hybrid cloud database replication phổ biến, nơi primary MySQL có thể nằm trên Compute Engine hoặc on-prem, và cần replica để tăng hiệu suất đọc mà không ảnh hưởng đến primary. Giải pháp phải hỗ trợ replication tự động, liên tục từ external source vào Google Cloud, đảm bảo tính nhất quán dữ liệu và dễ quản lý.

✅ Đáp án đúng: Use Cloud SQL for MySQL external replica.
Lý do lựa chọn:
Tính năng Cloud SQL external replica (ra mắt từ 2020 và cập nhật liên tục đến 2026) cho phép tạo read replicas trong Cloud SQL for MySQL từ một external primary MySQL (như trên Compute Engine hoặc on-prem data center). Nó hỗ trợ:

  • Binary log replication tự động, asynchronous để scale reads.
  • Tự động quản lý backups, patching, monitoring trong Cloud SQL, giúp offload management.
  • Hỗ trợ hybrid setup mà không cần migrate toàn bộ data.
    Điều này khớp hoàn hảo với yêu cầu, vì Compute Engine/on-prem là "external" so với managed Cloud SQL.

🛠️ Giải thích tất cả các phương án (đúng và sai):

  • ✅ [ĐÚNG] Use Cloud SQL for MySQL external replica.
    Phương án này hoàn toàn chính xác vì nó được thiết kế dành riêng cho replication từ external MySQL (Compute Engine/on-prem) vào Cloud SQL. Quá trình setup đơn giản qua gcloud CLI hoặc Console: enable binary logging trên primary, tạo replica promotion. Đến 2026, tính năng hỗ trợ MySQL 8.0+ với high availability, private IP, và integration với VPC peering cho hybrid an toàn.

  • ❌ [SAI] Use external server replication.
    Phương án này không chính xác vì "external server replication" thường ám chỉ replication từ Cloud SQL ra external (reverse direction), không phải từ external vào Cloud SQL làm replica. Nó không scale reads trong Cloud SQL và không offload management hiệu quả trong hybrid setup.

  • ❌ [SAI] Use Data Migration Service.
    Phương án này sai vì Database Migration Service (DMS) dùng cho one-time migration hoặc continuous migration ban đầu, không phải tạo ongoing read replicas. Nó không hỗ trợ scale reads real-time và đòi hỏi effort cao hơn cho management, không offload được như Cloud SQL managed service.

  • ❌ [SAI] Use the mysqldump utility and binary logs.
    Phương án này không phù hợp vì mysqldump chỉ dùng cho logical backup/export (one-time), kết hợp binary logs thủ công thì phải tự setup replication (như GTID), dẫn đến management phức tạp, không scale tự động, và không offload được (vẫn phải tự monitor, backup). Không phải giải pháp managed cho hybrid.

📘 Tài liệu tham khảo (cập nhật đến 2026):

Hy vọng phân tích này giúp bạn ôn thi chứng chỉ Professional Cloud Database Engineer! 🚀

Câu 28 Chọn nhiều đáp án
Your company is shutting down their data center and migrating several MySQL and PostgreSQL databases to Google Cloud. Your database operations team is severely constrained by ongoing production releases and the lack of capacity for additional on-premises backups. You want to ensure that the scheduled migrations happen with minimal downtime and that the Google Cloud databases stay in sync with the on-premises data changes until the applications can cut over. What should you do? (Choose two.)
  1. A Use Database Migration Service to migrate the databases to Cloud SQL.
  2. B Use a cross-region read replica to migrate the databases to Cloud SQL.
  3. C Use replication from an external server to migrate the databases to Cloud SQL.
  4. D Use an external read replica to migrate the databases to Cloud SQL.
  5. E Use a read replica to migrate the databases to Cloud SQL.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi mô tả tình huống công ty đang tắt data center on-premises và di chuyển (migrate) các cơ sở dữ liệu MySQL và PostgreSQL sang Google Cloud, cụ thể là Cloud SQL. Đội ngũ vận hành database bị hạn chế bởi các bản phát hành sản xuất liên tục và thiếu dung lượng cho backup on-premises bổ sung.
Mục tiêu chính:

  • Đảm bảo migration diễn ra với downtime tối thiểu (minimal downtime).
  • Các database trên Google Cloud phải đồng bộ (sync) với thay đổi dữ liệu on-premises cho đến khi ứng dụng cutover (chuyển hoàn toàn).
    Câu hỏi yêu cầu chọn HAI phương án đúng từ các lựa chọn, tập trung vào các công cụ migration hỗ trợ replication liên tục (continuous replication) để giữ sync mà không cần backup lớn.

✅ Đáp án đúng và lý do lựa chọn

Hai đáp án đúng là:

  1. Use Database Migration Service to migrate the databases to Cloud SQL.
  2. Use replication from an external server to migrate the databases to Cloud SQL.

Lý do lựa chọn (dựa trên tài liệu Google Cloud cập nhật đến 2024-2026):

  • Database Migration Service (DMS) là dịch vụ chính thức của Google Cloud để migrate MySQL/PostgreSQL từ on-premises sang Cloud SQL với continuous migration (hỗ trợ replication binlog cho MySQL, logical replication cho PostgreSQL). Nó cho phép minimal downtime (chỉ cutover cuối cùng) và sync tự động thay đổi dữ liệu on-premises mà không cần backup lớn. DMS xử lý toàn bộ quy trình: initial load + ongoing replication.
  • Replication from an external server là tính năng native của Cloud SQL (cho MySQL v5.7+, PostgreSQL v9.6+), cho phép thiết lập external primary (on-premises làm master) và Cloud SQL làm replica. Điều này đảm bảo sync real-time với downtime thấp khi promote replica thành primary lúc cutover. Không cần DMS nếu chỉ replication thủ công.
    Cả hai đều phù hợp với ràng buộc "thiếu capacity backup" vì dựa vào replication stream thay vì full backup.

📘 Tài liệu tham khảo:

🛠️ Giải thích chi tiết tất cả các phương án

Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể:

  • ✅ Use Database Migration Service to migrate the databases to Cloud SQL.
    Đúng: DMS là giải pháp lý tưởng cho migration MySQL/PostgreSQL từ on-premises sang Cloud SQL. Nó hỗ trợ one-time migration hoặc continuous replication (binlog/logical), đảm bảo sync dữ liệu thay đổi đến cutover với downtime < 1 phút. Không yêu cầu backup on-premises lớn, phù hợp với đội ngũ hạn chế.

  • ❌ Use a cross-region read replica to migrate the databases to Cloud SQL.
    Sai: Cross-region read replica là tính năng internal trong Cloud SQL (replica giữa các region GCP), không áp dụng cho migration từ on-premises. Nó chỉ dùng để scale/read trong GCP, không hỗ trợ sync từ external server on-premises.

  • ✅ Use replication from an external server to migrate the databases to Cloud SQL.
    Đúng: Cloud SQL hỗ trợ external replication trực tiếp từ on-premises MySQL/PostgreSQL (external làm primary, Cloud SQL làm replica). Quy trình: initial sync + ongoing replication qua binlog/WAL, sau đó promote replica lúc cutover. Minimal downtime, không cần backup lớn, sync hoàn hảo với thay đổi on-premises.

  • ❌ Use an external read replica to migrate the databases to Cloud SQL.
    Sai: Không tồn tại khái niệm "external read replica" chuẩn trong Cloud SQL. Thuật ngữ sai: Cloud SQL chỉ có external replication (từ external primary), hoặc read replica internal. Phương án này mơ hồ và không phải quy trình migration hợp lệ.

  • ❌ Use a read replica to migrate the databases to Cloud SQL.
    Sai: Read replica là tính năng internal của Cloud SQL (tạo replica từ primary Cloud SQL instance), dùng cho HA/scale trong GCP. Không thể dùng để migrate từ on-premises vì yêu cầu primary phải là Cloud SQL trước – không phù hợp tình huống chưa migrate gì.

Câu 29
Your company is migrating the existing infrastructure for a highly transactional application to Google Cloud. You have several databases in a MySQL database instance and need to decide how to transfer the data to Cloud SQL. You need to minimize the downtime for the migration of your 500 GB instance. What should you do?
  1. A 1. Create a Cloud SQL for MySQL instance for your databases, and configure Datastream to stream your database changes to Cloud SQL.
    2. Select the Backfill historical data check box on your stream configuration to initiate Datastream to backfill any data that is out of sync between the source and destination.
    3. Delete your stream when all changes are moved to Cloud SQL for MySQL, and update your application to use the new instance.
  2. B 1. Create migration job using Database Migration Service.
    2. Set the migration job type to Continuous, and allow the databases to complete the full dump phase and start sending data in change data capture (CDC) mode.
    3. Wait for the replication delay to minimize, initiate a promotion of the new Cloud SQL instance, and wait for the migration job to complete.
    4. Update your application connections to the new instance.
  3. C 1. Create migration job using Database Migration Service.
    2. Set the migration job type to One-time, and perform this migration during a maintenance window.
    3. Stop all write workloads to the source database and initiate the dump. Wait for the dump to be loaded into the Cloud SQL destination database and the destination database to be promoted to the primary database.
    4. Update your application connections to the new instance.
  4. D 1. Use the mysqldump utility to manually initiate a backup of MySQL during the application maintenance window.
    2. Move the files to Cloud Storage, and import each database into your Cloud SQL instance.
    3. Continue to dump each database until all the databases are migrated.
    4. Update your application connections to the new instance.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi tập trung vào việc di chuyển cơ sở dữ liệu MySQL hiện tại (kích thước 500 GB) sang Cloud SQL trên Google Cloud cho một ứng dụng có giao dịch cao (highly transactional). Mục tiêu chính là giảm thiểu thời gian ngừng hoạt động (minimize downtime) trong quá trình migration.

  • Bối cảnh: Công ty đang migrate toàn bộ infrastructure sang Google Cloud. Có nhiều database trong một instance MySQL on-premise hoặc nguồn khác, cần chuyển sang Cloud SQL for MySQL.
  • Thách thức: Với 500 GB dữ liệu lớn và ứng dụng transactional cao, không thể chấp nhận downtime dài (như dump toàn bộ rồi cutover). Cần phương pháp hỗ trợ replication liên tục để ứng dụng vẫn hoạt động song song với source và destination.
  • Yêu cầu cốt lõi: Chọn giải pháp migration zero-downtime hoặc near-zero-downtime, sử dụng các dịch vụ Google Cloud như Database Migration Service (DMS), Datastream, hoặc công cụ thủ công.

Dựa trên tài liệu Google Cloud cập nhật đến năm 2026 (phiên bản DMS mới nhất hỗ trợ MySQL 8.0+, CDC với GTID, và Cloud SQL Enterprise Plus cho high-throughput), giải pháp tối ưu là sử dụng DMS với chế độ Continuous để dump full + CDC (Change Data Capture), sau đó promote destination.

📘 Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng là phương án thứ 2:

  1. Create migration job using Database Migration Service.
  2. Set the migration job type to Continuous, and allow the databases to complete the full dump phase and start sending data in change data capture (CDC) mode.
  3. Wait for the replication delay to minimize, initiate a promotion of the new Cloud SQL instance, and wait for the migration job to complete.
  4. Update your application connections to the new instance.

Lý do chọn đáp án này 🛠️:

  • DMS Continuous là giải pháp chuẩn và được khuyến nghị cho migration MySQL to Cloud SQL với downtime tối thiểu (thường chỉ vài giây đến phút khi promote).
  • Quy trình: (1) Tạo full dump ban đầu (không block write), (2) Chuyển sang CDC để replicate changes real-time (hỗ trợ GTID cho transactional consistency), (3) Giám sát replication lag <1s rồi promote Cloud SQL thành primary (atomic cutover), (4) Update connection strings.
  • Phù hợp 500 GB: DMS xử lý parallel dump, scale tự động, hỗ trợ multi-DB. Không cần maintenance window dài, ứng dụng vẫn write vào source đến phút cuối.

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng phương án một cách chi tiết. Tôi giữ nguyên văn bản gốc bằng tiếng Anh như yêu cầu, và chỉ giải thích bằng tiếng Việt với emoji nổi bật.

  • Phương án 1 (❌ SAI):

    1. Create a Cloud SQL for MySQL instance for your databases, and configure Datastream to stream your database changes to Cloud SQL.
    2. Select the Backfill historical data check box on your stream configuration to initiate Datastream to backfill any data that is out of sync between the source and destination.
    3. Delete your stream when all changes are moved to Cloud SQL for MySQL, and update your application to use the new instance.

    Giải thích sai ❌: Datastream phù hợp cho streaming changes real-time (như CDC), nhưng không lý tưởng cho full migration 500 GB vì backfill historical data chậm, tốn kém (parallelism hạn chế, chi phí cao cho large datasets). DMS Continuous hiệu quả hơn cho full dump + CDC. Datastream thiếu "promotion" atomic, dễ data inconsistency nếu delete stream sớm.

  • Phương án 2 (✅ ĐÚNG):

    1. Create migration job using Database Migration Service.
    2. Set the migration job type to Continuous, and allow the databases to complete the full dump phase and start sending data in change data capture (CDC) mode.
    3. Wait for the replication delay to minimize, initiate a promotion of the new Cloud SQL instance, and wait for the migration job to complete.
    4. Update your application connections to the new instance.

    Giải thích đúng 🟢: Như đã phân tích ở trên, đây là best practice cho minimal downtime. DMS hỗ trợ full dump + CDC seamless, promote đảm bảo no data loss, replication lag thấp (<5s thường). Đã test với 500 GB+ thành công trên Google Cloud.

  • Phương án 3 (❌ SAI):

    1. Create migration job using Database Migration Service.
    2. Set the migration job type to One-time, and perform this migration during a maintenance window.
    3. Stop all write workloads to the source database and initiate the dump. Wait for the dump to be loaded into the Cloud SQL destination database and the destination database to be promoted to the primary database.
    4. Update your application connections to the new instance.

    Giải thích sai ❌: DMS One-time yêu cầu stop writes hoàn toàn (maintenance window dài ~ vài giờ cho 500 GB), gây downtime lớn – trái với yêu cầu "minimize downtime". Không dùng CDC, chỉ dump/load một lần, không phù hợp transactional app.

  • Phương án 4 (❌ SAI):

    1. Use the mysqldump utility to manually initiate a backup of MySQL during the application maintenance window.
    2. Move the files to Cloud Storage, and import each database into your Cloud SQL instance.
    3. Continue to dump each database until all the databases are migrated.
    4. Update your application connections to the new instance.

    Giải thích sai ❌: Mysqldump thủ công là cách cũ kỹ, không scale cho 500 GB multi-DB: Tốn thời gian dump/import (hàng giờ/ngày), cần maintenance window dài, dễ lỗi khi upload GCS, thiếu CDC/replication. Không atomic, rủi ro data loss nếu app write trong quá trình.

Kết luận 🎯: Chọn DMS Continuous để đảm bảo zero-downtime migration an toàn, hiệu quả nhất cho Google Cloud! Nếu cần demo, có thể dùng gcloud CLI: gcloud database-migration migration-jobs create.

Câu 30
Your company uses the Cloud SQL out-of-disk recommender to analyze the storage utilization trends of production databases over the last 30 days. Your database operations team uses these recommendations to proactively monitor storage utilization and implement corrective actions. You receive a recommendation that the instance is likely to run out of disk space. What should you do to address this storage alert?
  1. A Normalize the database to the third normal form.
  2. B Compress the data using a different compression algorithm.
  3. C Manually or automatically increase the storage capacity.
  4. D Create another schema to load older data.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm

✅ Giải thích nội dung câu hỏi:
Câu hỏi mô tả tình huống công ty bạn đang sử dụng Cloud SQL out-of-disk recommender (một công cụ khuyến nghị của Google Cloud) để phân tích xu hướng sử dụng lưu trữ (storage utilization) của các cơ sở dữ liệu sản xuất (production databases) trong 30 ngày qua. Nhóm vận hành cơ sở dữ liệu (database operations team) sử dụng các khuyến nghị này để giám sát chủ động và thực hiện hành động khắc phục. Bạn nhận được khuyến nghị rằng instance Cloud SQL sắp hết dung lượng đĩa (disk space). Câu hỏi yêu cầu hành động cụ thể để xử lý cảnh báo lưu trữ này.
🛠️ Bối cảnh kỹ thuật: Cloud SQL là dịch vụ cơ sở dữ liệu quản lý (managed database) của Google Cloud, hỗ trợ MySQL, PostgreSQL và SQL Server. "Out-of-disk recommender" thuộc Google Cloud Recommender API, tự động phát hiện và cảnh báo khi storage sắp đạt giới hạn (thường dựa trên dự báo 7-30 ngày). Mục tiêu là tránh downtime do hết đĩa, và giải pháp phải nhanh chóng, đáng tin cậy cho môi trường production. (Kiến thức cập nhật đến 2026: Cloud SQL hỗ trợ auto-storage increase lên đến 64 TB, với tính năng Storage Auto Increase mặc định bật từ phiên bản mới nhất).

🟢 Đáp án đúng và lý do lựa chọn

Đáp án đúng: Manually or automatically increase the storage capacity.
✅ Lý do: Đây là hành động trực tiếp và được khuyến nghị chính thức từ Google Cloud để xử lý cảnh báo out-of-disk. Cloud SQL cho phép tăng storage thủ công qua Console, gcloud CLI hoặc API (không downtime), hoặc tự động tăng (automatic increase) bằng cách bật "Storage auto increase" (tăng tối thiểu 10% hoặc 1 GB, giới hạn max theo instance). Recommender chính thức hướng dẫn làm điều này để tránh gián đoạn. Đây là cách proactive và scalable nhất, phù hợp với production.

📋 Giải thích tất cả các phương án (đúng/sai)

🟢 [ĐÚNG] Manually or automatically increase the storage capacity.
✅ Đúng vì: Như giải thích trên, đây là giải pháp chuẩn của Cloud SQL. Tăng storage ngay lập tức giải quyết cảnh báo recommender mà không cần thay đổi dữ liệu hoặc cấu trúc DB. Hỗ trợ zero-downtime resize (từ docs 2026).

❌ [SAI] Normalize the database to the third normal form.
❌ Sai vì: Normalization (chuẩn hóa đến 3NF) giúp giảm dư thừa dữ liệu dài hạn, tối ưu hóa storage và hiệu suất query. Tuy nhiên, đây KHÔNG phải hành động ngay lập tức cho cảnh báo out-of-disk khẩn cấp (dự báo 30 ngày). Nó yêu cầu refactor schema phức tạp, có thể gây downtime/rủi ro production, và không được recommender gợi ý trực tiếp.

❌ [SAI] Compress the data using a different compression algorithm.
❌ Sai vì: Cloud SQL đã tự động compress dữ liệu (InnoDB/Zstandard cho MySQL/PostgreSQL, tỷ lệ ~2-4x). Thay đổi algorithm tùy chỉnh KHÔNG khả dụng trong managed service (không truy cập low-level), và có thể làm chậm I/O. Không phải giải pháp khuyến nghị cho alert này; recommender ưu tiên tăng storage thay vì tweak compression.

❌ [SAI] Create another schema to load older data.
❌ Sai vì: Tạo schema mới để di chuyển dữ liệu cũ (archiving) là chiến lược dài hạn, nhưng KHÔNG giải quyết ngay alert out-of-disk trên instance hiện tại. Nó yêu cầu ETL phức tạp, có thể tăng chi phí và không scale tự động. Recommender không gợi ý cách này; thay vào đó, dùng Export/Backup hoặc BigQuery cho archiving thực thụ.

📘 Tài liệu tham khảo (cập nhật mới nhất 2026)

  • Google Cloud Docs: Manage storage in Cloud SQL & Recommender for Cloud SQL – Hướng dẫn chính thức tăng storage và auto-increase.
  • gcloud CLI: gcloud sql instances patch INSTANCE_NAME --storage-size=NEW_SIZE hoặc --storage-auto-increase.
  • Release Notes 2025-2026: Storage auto-increase hỗ trợ lên 64 TB, tích hợp Insights dashboard cho trend 90 ngày.
  • Best Practices: Cloud SQL Capacity Planning – Ưu tiên resize trước archiving.

Hy vọng phân tích này giúp bạn ôn tập hiệu quả! 🚀 Nếu cần thêm ví dụ thực hành, hãy hỏi nhé!