Backup MongoDB database copying files in `dbpath`

backupdatabase-backupmongodb

I need a daily backup of all MongoDB databases in our single-instance server (without stopping the MongoDB service). Our server is in Rackspace so I'm wondering if a valid strategy could be just add all the database files (files in dbpath) to our automatic backup.

I've considered another options as well, but this will save us a lot of time and seems simpler and easier. The question is: is this solution reliable?

Best Answer

without stopping the MongoDB service [...] is this solution reliable?

as is, no.

have a look at Backup by Copying Underlying Data Files

in order to have a consistent backup, the data you are backing up must not change during the whole backup process.

you said you can't stop the server so:

  • use LVM/filesystem snapshots

or

  • setup a replicaset, and perform backup with it. you'll be able to freeze/stop it as you want.
Related Topic