且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我应该只坚持使用 AWS RDS 自动备份还是数据库快照?

更新时间:2023-12-04 17:27:47

根据个人经验,我建议两者都做.我将自动备份设置为 8 天,然后我还有一个脚本,每天拍摄一次快照并删除超过 7 天的快照.原因是据我了解,在某些情况下,您无法从自动备份中恢复.例如,如果您不小心删除了 RDS 实例并且没有拍摄最终快照,您将无法访问已完成的自动备份.但是打开自动备份也很好,因为这将为您提供时间点恢复.

From personal experience, I recommend doing both. I have the automated backup set to 8 days, and then I also have a script that will take a snapshot once per day and delete snapshots older than 7 days. The reason is because from what I understand, there are certain situations where you could not restore from the automated backup. For example, if you accidentally deleted your RDS instance and did not take a final snapshot, you would not be able to access the automated backups that were done. But it is also good to have the automated backups turned on because that will provide you the point-in-time restore.

希望这会有所帮助.

编辑

为了回答您的评论,我在脚本创建快照时使用了特定的命名约定.类似的东西:

To answer your comment, I use a certain naming convention when my script creates the snapshots. Something like:

autosnap-实例名称-2012-03-23

autosnap-instancename-2012-03-23

当它进行清理时,它会检索所有快照、查找该命名约定、解析日期并删除任何早于特定日期的内容.

When it goes to do the cleanup, it retrieves all the snapshots, looks for that naming convention, parses the date, and deletes any older than a certain date.

我认为您也可以查看快照创建日期,但这就是我最终这样做的方式.

I think you could also look at the snapshot creation date, but this is just how I ended up doing it.