Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Second Hard Drive for MongoDB using directoryperdb

Does anyone have any experience using directoryperdb? I can't find very many examples of its usage and would like to run my thought process past some knowledgeable people first :)

I've got a near terabyte database, and want to add another on a separate hard drive. I can't mess it up since reintegrating my data takes hours.

I currently have:

  • --dbpath as /home/mongo
  • A new nice empty hard drive mounted on /hd/newhd

My process is as follows:

  1. Lets call the existing database old and the new one new.
  2. mkdir /home/mongo/old
  3. mv /home/mongo/* /home/mongo/old/
  4. Symlink /home/mongo/new to /hd/newhd/newmongodb
  5. vim /etc/mongod.conf ~ and set directoryperdb = true
  6. restart mongod and start inserting data into a new db called new

Does this look OK? Will it just automatically recognize the new folders and continue as normal?


Edit1: According to this: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-commits/frAjIDG08Mc the mongod.lock file should be in /home/mongo. What about the journal or _tmp directory?

like image 755
LittleBobbyTables Avatar asked Feb 22 '13 21:02

LittleBobbyTables


1 Answers

OK so I took the plunge and it worked fine~! :)

I'm now successfully saving data into the new db symlinked to the second HDD.

The only edit is that don't bother moving the journal folder into the db sub-directories as it will just be recreated in the main --dbpath

Hopefully someone else will find this post useful.

like image 63
LittleBobbyTables Avatar answered Nov 15 '22 05:11

LittleBobbyTables