Specifying dump directory in mongod.cfg file

114 views Asked by At

All,

Is there a system wide setting to specify the dump folder in MongoDB? I went through this link and couldn't find any.

Basically, I want C:\MongoDB\dump to be the folder where all backups are created. Currently, a dump folder is created in the folder mongodump is executed in or one has to specify a folder explicitly using --out parameter as a part of mongodump.

Instead, wherever I may execute mongodump from, I want the dumps to be always created in C:\MongoDB\dump

Thanks, rgn

2

There are 2 answers

0
Atish On

If you do not specify the --out paramater to the mongodump, it will create a dump directory in the current directory to store the database dump.

You can set a system level parameter for the base directory for all of your dumps. However, for every mongodump you take you will have to pass the --out parameter to uniquely identify that dump.

Failing to do so will overwrite the existing dumps within your base dump directory

0
olivier cherrier On

You can use mongodump

mongodump --host mongodb1.example.net --port 37017 --username user --password "pass" --out /opt/backup/mongodump-2011-10-24