olli
olli

Reputation: 73

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)?

Upvotes: 0

Views: 553

Answers (3)

olli
olli

Reputation: 73

After reading through the suggestions from D. SM and JJussi (thanks by the way), I'll be implementing the following infrastructure:

  • 3 monogs instances spaced across different datacenters
  • 3 config servers spaced across different datacenters
  • 2 shards with 2 storage servers spaced across different datacenters with an arbiter each (to cut down on costs for now) each

Thanks once again for your input.

Upvotes: 0

JJussi
JJussi

Reputation: 1580

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.

Upvotes: 2

D. SM
D. SM

Reputation: 14480

You need 3 servers in each replica set for redundancy. Either put the third one in one of the data centers or get a third data center.

  • The config replica set needs 3 servers.
  • Each of the shard replica sets needs 3 servers.
  • You can keep the 2 mongoses.

Upvotes: 1

Related Questions