Harry Pehkonen
Harry Pehkonen

Reputation: 3038

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.

Upvotes: 1

Views: 602

Answers (2)

Sammaye
Sammaye

Reputation: 43884

There is nothing wrong and in fact this is a typically good idea, mainly because it allows you to scale onto sharding with no downtime.

Of course for redundancy sake you would have more than one mongos. You would define, in each app, a list of load balanced mongos instances (in a more serious setup) which then back onto your cluster of replica set shards.

Upvotes: 2

Mason
Mason

Reputation: 8846

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.

Upvotes: 3

Related Questions