Search code examples
mongodbreplicationsharding

Using mongos with non-sharded replica sets


Is there any advantage or disadvantage to using mongos in front of just a replica set (as opposed to a sharded cluster)? Having to specify the same replica set members in multiple apps doesn't feel right to me -- I'd rather do it in one central place.

If anything, sharding in the future would be more straight-forward. Right?

Thanks in advance! Harry.


Solution

  • The downside is that you've likely introduced a single point of failure into your application. If the mongos goes down then the mongods are no longer accessible - you've defeated the high availability of replica sets.

    You could set up multiple mongos instances but then you're back in the same boat. You could theoretically set up a load balancer in front of your mongos instances so that you only have to list one address and can still have high availability.