Thursday, April 3, 2014

Limit MongoDB disk usage on your machine

When doing local development, you might want to limit how much space mongodb uses.

Note: Do not do this in production unless you know what you are doing. It will affect performance.

If you are on Ubuntu perform these steps:

  1. Stop mongodb
    sudo service mongodb stop
  2. Edit the mongodb configuration
    sudo nano /etc/mongodb.conf
  3. Add this to the file and save/close:
  4. Remove old journal files:
    sudo rm -rf /var/lib/mongodb/journal
  5. Start mongodb
    sudo nano service mongodb start