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

2021-11-27 00:00:00 amazon-web-services mysql amazon-rds

我使用的是 AWS RDS for MySQL.说到备份,我知道亚马逊提供了两种类型的备份——自动备份和数据库 (DB) 快照.此处解释了差异.但是,我仍然感到困惑:我应该坚持只使用自动备份还是同时使用自动和手动(数据库快照)?

I am using AWS RDS for MySQL. When it comes to backup, I understand that Amazon provides two types of backup - automated backup and database (DB) snapshot. The difference is explained here. However, I am still confused: should I stick to automated backup only or both automated and manual (db snapshots)?

你们觉得怎么样?你自己的设置是什么?我从其他人那里听说自动备份不可靠,因为当数据库实例崩溃时某些数据库不可恢复,因此数据库快照是拯救您的方法.如果我要将每日数据库快照作为与自动备份类似的设置,我将支付很多钱.

What do you think guys? What's the setup of your own? I heard from others that automated backup is not reliable due to some unrecoverable database when the DB instance is crashed so the DB snapshots are the way to rescue you. If I am to do daily DB snapshots as similar settings to automated backup, I am gonna pay much bunch of bucks.

希望任何人都可以启发我或建议我正确的设置.

Hope anyone could enlighten me or advise me the right set up.

推荐答案

根据个人经验,我建议两者都做.我将自动备份设置为 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.

相关文章