Tag Archives: conf

MongoDB Journalling

A quick one if you are wondering about MongoDB and Journalling (especially on Debian/Ubuntu from the MongoDB repo) .

By default mongodb will generate 3gig of journal files in /var/lib/mongodb/journal this is far from ideal if you are running on a Rackspace CloudServer or smaller VPS.

There are two easy solutions:

  • If you are running as part of a ReplicaSet then you can choose to go without journalling altogether with the
    nojournal=true

    option in mongodb.conf.

  • Alternatively you can request that MongoDB uses smaller preallocated files for journalling use the
    smallfiles=true

    option in mongodb.conf.

To also reduce some usage in your datafiles there is the also the

noprealloc = true

option, however I don’t see this as particularly useful considering the preallocation starts pretty small and only grows as your data does.

Nginx virtual host ordering

Just a quick note.

Nginx will include configuration files based on ASCII ordering. This means that even if you have two files default (with the default config) and cloud, cloud will be included before default and will answer for any undefined hostnames.

The easy way to solve this (and obvious if you have been around Linux for a while) is to prefix all config files with a number. For example:

00-default
10-wildcard.example.com
10-wildcard.foo.com

This will result in 00-default being included in the configuration first.

I hope this is useful for someone out there.