Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

MongoDB Production Configuration

Victor Voisin edited this page Feb 24, 2014 · 2 revisions

Things to remember for a production cluster architecture.

Components

  • Config Servers: 3. Each config server must be on separate machines. If we have multiple sharded clusters, we will need to have a group of config servers for each cluster. If the name or address of a config server changes, it is necessary to restart all mongod and mongos, so use CNAMEs! Backups of such servers are critical.
  • Shards: 2+. A shard is a replica set.
  • Query Routers (mongos): 1+. Typically, deployments have one mongos instance on each application server.

UNIX ulimit Settings

  • -f (file size): unlimited
  • -t (cpu time): unlimited
  • -v (virtual memory): unlimited [1]
  • -n (open files): 64000
  • -m (memory size): unlimited [1]
  • -u (processes/threads): 32000

Always remember to restart your mongod and mongos instances after changing the ulimit settings to make sure that the settings change takes effect.

Compacting

Over time, collections in a MongoDB database can become fragmented. In the long run, this can result in your databases taking up more space on disk and in RAM to hold the same amount of data. See Always Be Compacting.