想要对mongodb进行增量备份.日记? Oplog? [英] Want to do an incremental backup for mongodb. Journaling? Oplog?

查看:528
本文介绍了想要对mongodb进行增量备份.日记? Oplog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为单个mongodb数据库进行每日备份,可能是使用mongodump.为了不丢失任何数据,我希望这是渐进式的,因此,如果一天中出现问题,我需要能够在进行mongorestore后重播当天的更改,直到失败为止.

I want to daily backups for a single mongodb database, probably with mongodump. To not lose any data, I would like this to be incremental so if something goes wrong in the middle of the day, I need to be able to replay changes for that day up til the point of failure after doing a mongorestore.

我是否正确理解我需要为此使用操作日志?还是记录答案?我尝试执行以下操作:

Am I understanding correctly that I need to use an oplog for this? Or is journaling the answer? I tried doing the following:

  1. 将我的mongo数据库变成只有一个的副本集,以便创建操作日志. (感觉很hacky)
  2. 使用--oplog选项重新启动mongod
  3. 执行应记录在操作日志中的更改

但是什么都没有存储在操作日志中.进行此类增量备份的最佳方法是什么?我基本上是在寻找一种类似的方法来重播mysql binlog.

However nothing ever gets stored in the oplog. What is the best way to do such incremental backups? I'm basically looking for a similar approach to replaying the mysql binlog.

谢谢

推荐答案

MongoDB并不提供开箱即用的增量备份选项,但是可以进行文件快照并重播oplog.您是否按照文档中概述的步骤将服务器设置为副本集? http://www.mongodb.org/display/DOCS/Replica+Sets+- +基础

MongoDB doesn't provide an incremental backup option out of the box, but it's possible to do a file snapshot and replay the oplog. Did you set up your server as a replica set following the steps outlined in the documentation? http://www.mongodb.org/display/DOCS/Replica+Sets+-+Basics

您还能告诉我们这些备份的目的吗?您是否考虑过将第二个节点添加到副本集中以提高数据持久性?

Could you also tell us the purpose of these backups? Have you considered adding a second node to your replica set for data durability?

如果您已经完成了将服务器设置为副本集成员的步骤,那么可以在shell中运行rs.status()吗?

If you've walked through the steps to set up the server as a member of a replica set, can you run rs.status() in the shell?

另一个要注意的地方(只是为了澄清)-日记并不意味着要作为备份策略;日志记录仅确保在发生故障转移时数据库可以返回一致状态.强烈建议在启用日记功能的情况下运行.

One other note (just to clarify)- journaling is not meant to be a backup strategy; journaling merely ensures that the database can return to a consistent state in the event of failover. Running with journaling enabled is highly recommended.

这是用于备份的MongoDB文档: http://www.mongodb.org/display/DOCS/Backups

Here is the MongoDB documentation for backups: http://www.mongodb.org/display/DOCS/Backups

这篇关于想要对mongodb进行增量备份.日记? Oplog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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