Note If you can think of some really awesome content to be here(second result in google for "arch linux mongodb", post it in a comment and I'll either post it here or at least link to it
Dear MongoDB, stop sucking so much.
Basically, every once in a while my VPS will be forced to restart. This means MongoDB doesn't get shut down properly.. Which of course means you'll have to run a repair. However, does Arch Linux's package for MongoDB do automatic repairs? Of course not, probably because its a bit unsafe. But worse yet, after doing
sudo mongodb --dbpath /.... --repair everything will seem to work fine. So you do the simple
sudo /etc/rc.d/mongodb start
and you see
:: Starting mongodb [DONE]
as is expected. But then you try to use MongoDB and it doesn't work. Whaiiiiiiii!?
Well, apparently Arch Linux's support for MongoDB also doesn't check any sort of error message. So you'll never see a
FAIL unless the mongod file doesn't exist somehow. The reason for this is hidden in /var/log/mongod.
Apparently, when you run mongod as a user it will automatically
chown all of the files in the dbpath to the currently running user. That sounds good right? Well, it's not good when you run repair as root, and then try to run mongod as the mongodb user.
- Either sudo in as the mongodb user when doing a repair, or
chownthe dbpath back to the mongodb user after running a repair.
I prefer the latter, but it's personal choice.