MongoDB备份计划 [英] MongoDB backup plan

查看:79
本文介绍了MongoDB备份计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从MySQL切换到MongoDB,但是丢失大量数据(超过1小时)对我来说是不可接受的.

I want to switch from MySQL to MongoDB but great data losses (more than 1 hour) are not acceptable for me.

我需要3个备份计划:

  1. 每小时备份计划.数据每隔X分钟刷新一次到磁盘,如果服务器出现问题,我将确保至少在一个小时后重新启动后将拥有所有数据.我可以配置它吗?

  1. Hourly backup plan. Data is flushed to disk every X minutes and if something wrong with the server I shall be sure that after reboot it will have all data at least for an hour ago. Can I configure it?

每日备份计划.每天都会将数据同步到备份磁盘,因此,即使服务器发生爆炸,我也可以在几个小时内恢复昨天的数据.我应该使用fsync,主从还是其他?我希望流量最少,因此理想情况下将仅发送更改.

Daily backup plan. Data is synced to backup disk every day so even if server explodes I can recover data for yesterday in some hours. Should I use fsync, master-slave or something else? I would like to have minimal traffic so ideally only changes will be sent.

每周备份计划.数据已同步到第二个备份磁盘,因此如果服务器和第一个备份磁盘都爆炸,则我至少有上周的数据.这是可靠性的问题,因此可以通过网络发送所有数据.

Weekly backup plan. Data is synced to second backup disk so if both server and first backup disk explode I have at least data for last week. Here this is the question of reliability so it's ok to send all data via network.

我该怎么办?

推荐答案

  1. fsync命令将数据刷新到磁盘.默认情况下,它每60秒执行一次,但可以使用--syncdelay命令行参数进行配置.

  1. The fsync command flushes the data to disk. It is executed each 60 seconds by default, but can be configured using the --syncdelay command line parameter.

备份文档可以为每日和每周备份提供一些很好的指导.对于日常备份,主从配置似乎是最佳选择,因为它只会同步更改.

The documentation on backups has some good pointers for daily and weekly backups. For the daily backup, a master-slave configuration seems like the best option, as it will only sync changes.

对于每周备份,您还可以使用主从配置或复制.另一个选项是 mongodump实用程序,它将支持-整个数据库.它能够在数据库运行时创建备份,因此您可以在主数据库或从数据库之一上运行它.您也可以锁定从属服务器,然后再进行备份.

For the weekly backup you can also use a master-slave configuration, or replication. Another option is the mongodump utility, which will back-up the entire database. It is capable of creating backups while the database is running, so you can run it on the main database or one of the slaves. You can also lock the slave before backing it up.

这篇关于MongoDB备份计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆