mongodbshardingmongodb-replica-setmongodb-cluster

MongoDB Sharding and Replication


I've already setup MongoDB sharding and now I need to setup replication for availability. How do I do this? I've currently got this:

Do I just setup replication on each server (by assigning each a secondary)?


Solution

  • I would build the whole system in 3 DCs', for redundancy. Every data center would have three servers with services of:

    1. 1x mongoS at Server1
    2. 1x node of config server replica set at Server1
    3. 1x node of shard1 replica set at Server2
    4. 1x node of shard2 replica set at Server3

    So, a total of 9 nodes (physical or virtual).

    If we "lose" one DC, everything works still, because we have a majority in all three replica sets.