Choose a topology
How many nodes you run and on which machines, plus the way the cluster presents itself to your applications.
Decide how many nodes you run, on which machines and how the cluster presents itself to your applications, before installing anything.
Requirements
- Knowing how many machine failures your service has to survive.
How many nodes
| Nodes | What for |
|---|---|
| 1 | Development and tests. If the machine goes down, the cluster stops answering. |
| 3 | Production. Each range keeps answering if one of the three machines goes down. |
| 5 or more | More capacity; ranges and their leaders are spread across all of them. |
Where to put them
Each node goes on its own machine. If you use zones or data centres, spread the machines so the loss of one does not take a majority of the replicas of a range.
How it presents itself
By default the cluster presents itself as a mongos. If your tools expect a replica set, change the presentation live.
Check
Once the topology is decided, go through the production checklist before installing the binary on the machines.
Common problems
- Two nodes survive the loss of neither, because a range needs a majority of its replicas. Use one or three.