Want to do incremental backup for mongodb. Journaling? Oplog?

I want to back up daily for one mongodb database, possibly using mongodump. In order not to lose any data, I would like it to be incremental, therefore, if something goes wrong in the middle of the day, I need to be able to reproduce the changes for this day until the moment of failure after the mongorestore.

Do I understand correctly that oplog needs to be used for this? Or is the response logged? I tried to do the following:

  • Turning my mongo database into a replica set of only one, so that it creates an oplog. (It seems pretty hacked)
  • Restart mongod with the -oplog option
  • Making changes to be written to oplog

However, nothing is saved in oplog. What is the best way to do such incremental backups? I am basically looking for a similar approach to playing the mysql binary file.

thanks

+6
source share
2 answers

MongoDB does not provide the option of incremental backups out of the box, but it is possible to take a snapshot of the file and play oplog. Did you configure the server as a set of replicas by following the steps described 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 went through the steps to configure the server as a member of the replica set, can you run rs.status () in the shell?

One more note (just for clarification) - journaling is not intended for a backup strategy; Logging simply ensures that the database can return to a consistent state in the event of a failure. It is recommended that you work with the log enabled.

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

+5
source

The best way to make backups is to configure Ops Manager as part of your MongoDB infrastructure, but it does much more than just backups ...

0
source

Source: https://habr.com/ru/post/922965/


All Articles