[英]Can I use GCP Snapshot for data or database backup? can I trust the snapshot to restore my DB data?
I am using the Google cloud platform and compute engine for my project, Installed MongoDB into the instance server, what is the best way to take my database back-up and restore我正在为我的项目使用谷歌云平台和计算引擎,将 MongoDB 安装到实例服务器中,备份和恢复我的数据库的最佳方法是什么
my options:我的选择:
Let me know the best way of handling this.让我知道处理此问题的最佳方法。
Due to the non-reliable snapshot size got confused a bit.由于不可靠的快照大小有点混乱。
While schedule snapshot虽然计划快照
Yes you can use snapshot.是的,您可以使用快照。 Also consider below suggestion也考虑下面的建议
Use additional data disk attached to Compute Instance for Database.使用附加到 Compute Instance for Database 的附加数据磁盘。 In case any failure detach the disk and attach to new vm instance.如果出现任何故障,请分离磁盘并附加到新的 vm 实例。 Snapshot will help you in regional failure or when you need to restore backup in another region.Also snapshot size seems confusing to you because snapshots are incremental in nature.快照将在区域故障或需要在另一个区域恢复备份时为您提供帮助。快照大小也让您感到困惑,因为快照本质上是增量的。 ex.前任。 snapshot-1 taken at 2:00 AM contains 10GB data.在凌晨 2:00 拍摄的快照 1 包含 10GB 数据。 now you added 1 GB data to the disk at 2:30 AM and taken snapshot again at 3:00 AM.现在您在凌晨 2:30 向磁盘添加了 1 GB 数据,并在凌晨 3:00 再次拍摄快照。 snapshot-2 at 3:00 AM will only contains 1 GB of data ( not 11 GB).凌晨 3:00 的快照 2 将仅包含 1 GB 的数据(不是 11 GB)。 but real magic is when you restore snapshot-2 , it will restore your complete 11GB of data as it contains reference to snapshot-1 with 10GB data.但真正神奇的是当您恢复 snapshot-2 时,它将恢复您完整的 11GB 数据,因为它包含对具有 10GB 数据的 snapshot-1 的引用。
Yes Snapshots are reliable.是的,快照是可靠的。 You can use snapshots to create point in time image for your disk.您可以使用快照为磁盘创建时间点映像。 In your case, you can take data disk snapshots.在您的情况下,您可以拍摄数据磁盘快照。 To recover data from snapshot create a disk from snapshot and attach to existing vm.要从快照中恢复数据,请从快照创建磁盘并附加到现有虚拟机。
To automate mounting this you can run the gcloud commands in a bash/python script.要自动安装它,您可以在 bash/python 脚本中运行 gcloud 命令。 https://cloud.google.com/compute/docs/disks/restore-snapshot#create-disk-from-snapshot https://cloud.google.com/compute/docs/disks/restore-snapshot#create-disk-from-snapshot
For taking regular snapshots you can setup snapshot schedule and how many times a day it should happen.对于定期拍摄快照,您可以设置快照计划以及一天应该发生多少次。 To save costs you can keep retention too.为了节省成本,您也可以保留保留。 https://cloud.google.com/compute/docs/disks/scheduled-snapshots https://cloud.google.com/compute/docs/disks/scheduled-snapshots
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.