I'm in the middle of setting up a backup strategy for mongo, was just curious to know if mongodump locks the database before performing the database dump?
Overwrite Filesmongodump overwrites output files if they exist in the backup data folder. Before running the mongodump command multiple times, either ensure that you no longer need the files in the output folder (the default is the dump/ folder) or rename the folders or files.
On the client side, mongodump does not encrypt the data when writing. This means that if you need the backup to be encrypted, you will need to encrypt the backup files after the backup completes.
mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance. mongodump is a utility for creating a binary export of the contents of a database.
The basic way to restore a database is to use the mongorestore command to specify the backup directory (dump directory) without any options. This option is suitable for databases located in the localhost (127.0. 0.1) using the port 27017.
I found this on mongo's google group:
Mongodump does a simple query on the live system and does not require a shutdown. Like all queries it requires a read lock while running but doesn't not block any more than normal queries.
If you have a replica set you will probably want to use the --oplog flag to do your backups.
Excerpt from above question
Locking and copying files is only an option when you don't have heavy write load.
mongodump
can be run against live server. It will create some additional load, so don't do it on peak hours. Also, it is advised to do it on a secondary node (if you don't use replica sets, you should).There are some complications when you have a DB so large that no single machine can hold it. See this document.
Also, if you have replica set, you take down one of secondaries and copy its files directly. See http://www.mongodb.org/display/DOCS/Backups:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With