Backup, point-in-time recovery và deletion protection
Sự cố dữ liệu phổ biến nhất thường đến từ thao tác của con người như ghi sai hay xoá nhầm; cần chuẩn bị sẵn cách khôi phục về thời điểm trước sự cố.
Hai sự cố dữ liệu phổ biến nhất không xuất phát từ phần cứng mà từ thao tác của con người: một lần deployment ghi sai dữ liệu, và một thao tác xoá nhầm. Chọn biện pháp MFTECH đã chuẩn bị, sau đó chạy mô phỏng:
Lúc 14:32, deployment mới ghi sai giá vào hàng loạt đơn hàng. Lúc 15:10, đội vận hành phát hiện sự cố. Bảng cần được khôi phục về đúng trạng thái ngay trước 14:32.
Chọn sự cố và phương án khôi phục, sau đó nhấn Chạy.
| Cách khôi phục | Trường hợp sử dụng | Điểm khôi phục |
|---|---|---|
| PITR (point-in-time recovery) | Cần khôi phục về đúng thời điểm trước sự cố | Bất kỳ giây nào trong 1–35 ngày, ra bảng mới |
| On-demand backup | Lưu giữ dài hạn, đáp ứng yêu cầu tuân thủ | Đúng thời điểm tạo backup |
| Deletion protection | Ngăn xoá nhầm | Không cần khôi phục: request xoá bị từ chối |
| Export to S3 | Phân tích bằng Athena, Glue, EMR; chuyển dữ liệu sang bucket của account hoặc Region khác | Một thời điểm bất kỳ trong cửa sổ PITR, ghi ra tệp DynamoDB JSON hoặc Amazon Ion trên S3 |
Export to S3 là tính năng được quản lý hoàn toàn: xuất toàn bộ bảng (full export) hoặc phần dữ liệu thay đổi trong một khoảng thời gian (incremental export) tại một thời điểm bất kỳ trong cửa sổ PITR, do đó bảng phải bật PITR. Export chạy bất đồng bộ, không tiêu tốn RCU và không ảnh hưởng hiệu năng hay tính sẵn sàng của bảng; AWS không cam kết thời gian hoàn tất. Đây là bản sao dữ liệu phục vụ phân tích, không phải cơ chế bảo vệ bảng: export không ngăn được thao tác xoá bảng, và để dùng lại dữ liệu cần import from S3, thao tác luôn tạo một bảng mới. Nếu MFTECH chỉ export thủ công mỗi tuần, một sự cố xoá bảng có thể làm mất dữ liệu của tối đa một tuần, cộng thêm thời gian import và chuyển ứng dụng sang bảng mới.
- Khôi phục về một thời điểm chính xác tới từng giây: PITR.
- Ngăn xoá nhầm với chi phí vận hành thấp nhất: deletion protection.
- Phân tích dữ liệu bảng bằng Athena mà không tiêu tốn RCU: export to S3 (cần bật PITR).
- Streams, global tables và export to S3 không thay thế cho deletion protection và PITR.
Backup, point-in-time recovery and deletion protection
The most common data incidents come from human actions such as bad writes or accidental deletes; a way to restore to a point before the incident must be ready in advance.
The two most common data incidents come not from hardware but from human actions: a deployment that writes bad data, and an accidental delete. Choose the measure MFTECH put in place, then run the simulation:
Lúc 14:32, deployment mới ghi sai giá vào hàng loạt đơn hàng. Lúc 15:10, đội vận hành phát hiện sự cố. Bảng cần được khôi phục về đúng trạng thái ngay trước 14:32.
Chọn sự cố và phương án khôi phục, sau đó nhấn Chạy.
| Recovery option | Use case | Restore point |
|---|---|---|
| PITR (point-in-time recovery) | Restore to the exact moment before an incident | Any second within 1–35 days, to a new table |
| On-demand backup | Long-term retention, compliance requirements | The exact moment the backup was created |
| Deletion protection | Prevent accidental deletes | Nothing to restore: the delete request is denied |
| Export to S3 | Analytics with Athena, Glue, EMR; moving data to a bucket in another account or Region | Any point in time within the PITR window, written as DynamoDB JSON or Amazon Ion files in S3 |
Export to S3 is a fully managed feature: it exports the whole table (full export) or the data changed during a time period (incremental export) from any point in time within the PITR window, so the table must have PITR enabled. Exports are asynchronous, do not consume RCUs and have no impact on table performance or availability; AWS does not guarantee completion times. It is a copy of the data for analytics, not a protection mechanism for the table: an export does not stop a table from being deleted, and reusing the data requires import from S3, which always creates a new table. If MFTECH only exported manually every week, a deleted table could lose up to a week of data, plus the time to import and switch the application to the new table.
- Restore to an exact point in time, down to the second: PITR.
- Prevent accidental deletes with the least operational overhead: deletion protection.
- Analyze table data with Athena without consuming RCUs: export to S3 (requires PITR).
- Streams, global tables and export to S3 do not replace deletion protection and PITR.