Tao Te KaChing
Workin' the cash register of the Great Tao

MongoDB and Me…

Quick post here as a reference both for you and me.

I’ve been doing a lot of with lately with PHP and MongoDB using a VirtualBox build for development.  A big PITA is when, say, the power goes out or Windows restarts computer at night from automatic updates.  My Ubuntu image reboots just fine after, rarely having to do an inode check.  But often the MongoDB daemon does not start after.  It starts often enough to where I don’t think to verify the service is running after a reboot, so I will go in to do some PHP work only to end up with the site coming up blank.  Turns out it’s a simple issue of deleting the .lock file the daemon creates and then starting the service back up.

On my Ubuntu image, it’s at /var/lib/mongodb/mongod.lock.  If you don’t find it there just do a nice find / | grep –i mongo | grep –i lock.  If you get permissions issues running this command (say, on Ubuntu or Mint), run it with sudo and you should be good to go.

MongoDB rocks, btw.