mongodb备份oplog,想要对mongodb进行增量备份。日记? Oplog?

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:

Turning my mongo database into a replica set of just one, so that it creates an oplog. (This feels pretty hacky)

Restarting mongod with the --oplog option

Performing changes that should be recorded in the oplog

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.

Thanks

解决方案

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?

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.

Here is the MongoDB documentation for backups:

http://www.mongodb.org/display/DOCS/Backups

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值