0

Is it possible to change the data directory for a specific database in mongo? I'm optimizing a particular database for speed and I would like to move it to an SSD drive. The drive is not large enough to store all other databases in the machine though.

1 Answer 1

1

You can't specify the path for a specific database, but you can accomplish the same thing at the filesystem level by doing something like this:

  1. Run with directoryPerDB enabled (if you are turning this on, make sure that you move your existing data files into the correct folder
  2. Let's assume your database is called foo - you now have a folder "foo" that contains all the data files for that database
  3. Copy that folder onto your SSD
  4. Use a symbolic link/alias to point from your dbpath folder to the new folder on the SSD

Note: On Linux you can also just mount the SSD at /path/to/dbpath/foo and then copy the data files to the folder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .