How to use backup and restore all databases from mongodb?

If I want to make a general backup for all databases in mongodb , all I have to do is:

$ mongodump

      

And if I want to restore the last dump I created, all I have to do is:

$ mongorestore

      

  • Where are the backups of the stored mongodump file stored?
  • How do I specify a specific dump for all recovered databases?
+3


source to share


1 answer


The backups are stored in the directory you specified with the -out option on the command line. If you do not specify any output directory, the backup will be placed in the directory. / dump. With mongorestore, you have to specify the directory you dumped to earlier as a command line argument.

In a closed environment, the backup will be flattened if you are using mongodump via mongo. After restoring, you will have to redraw the collections. therefore, recovery is not always easy. See the documentation: http://docs.mongodb.org/manual/tutorial/backup-small-sharded-cluster-with-mongodump/



You can also dump db folders directly, check cli options.

For scalded clusters, you can check the capabilities here: http://docs.mongodb.org/manual/administration/backups/#sharded-cluster-backups

+6


source







All Articles