Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I move the mongodb journal to a different hard disk? It appears to be hard coded

Tags:

mongodb

At https://docs.mongodb.com/manual/core/write-performance/, it says

If the journal and the data file reside on the same block device, the data files and the journal may have to contend for a finite number of available I/O resources. Moving the journal to a separate device may increase the capacity for write operations.

That sounds great! Except in dur_journal.cpp, at src/mongo/db/storage/mmap_v1 (https://github.com/mongodb/mongo/blob/master/src/mongo/db/storage/mmap_v1/dur_journal.cpp), it has the following code:

boost::filesystem::path getJournalDir() {
    boost::filesystem::path p(storageGlobalParams.dbpath);
    p /= "journal";
    return p;
}

So it appears that the journal directory is hard coded to be a sub directory of the database directory. I could use a symbolic link to put it on a different disk, but this feels like I'm doing something wrong.

How do I handle this?

like image 678
Nikhil Avatar asked Oct 19 '22 06:10

Nikhil


1 Answers

You would mount another volume at the hardcoded location.

mount /dev/<device> <dbpath>/journal
like image 199
Tyler Brock Avatar answered Oct 21 '22 04:10

Tyler Brock