Installing and Configuring MongoDB on Praxis/Gentoo Linux

MongoDB is a "web-scale" key-value NoSQL document oriented database. MongoDB is similar to CouchDB but is designed to handle a different style work-load.

Installing MongoDB

Ensure that the proper USE flags are set.

[ebuild  N    ~] dev-lang/spidermonkey-1.7.0-r2  USE="threadsafe unicode"
[ebuild  N    ~] app-arch/snappy-1.0.4  USE="-static-libs"
[ebuild  N     ] dev-util/scons-2.1.0  USE="-doc"
[binary  N     ] app-admin/eselect-boost-0.4
[binary  N     ] dev-libs/boost-1.48.0-r2  USE="-debug -doc eselect -icu -mpi python -static-libs -test -tools"
[ebuild  N    ~] dev-db/mongodb-2.0.5  USE="-mms-agent -static-libs -v8"

Configuring MongoDB

MongoDB is crazy easy to configure (initially), edit the settings in /etc/conf.d/mongodb.

# Mongodb essentials
MONGODB_EXEC="/usr/bin/mongod"
MONGODB_RUN="/var/run/mongodb"
MONGODB_DATA="/var/lib/mongodb"
MONGODB_USER="mongodb"

# Listen to specified IP, comment this to listen to all
MONGODB_IP="127.0.0.1"

# Listen to specified port
MONGODB_PORT="27017"

# Set extra options here, such as disabling the admin web server
MONGODB_OPTIONS="--journal"

Tuning MongoDB

Looking at the manual for MongoDB.

Securing Mongo

  1. Ensure that Mongo is bound to the correct IP (bindIp) and that correct firewall rules are in place