I have followed the tuturial Deploy a Sharded Cluster

I have setup

  1. config server replica set with 3 members (cfg1, cfg2, cfg3) [replica set name = configserverreplica]

  2. mongodb server replica set with 3 members (mongoserver01, mongoserver02, mongoserver03) [replica set name = mongodbreplicaset]

  3. on another node named foreign-connector on which I am running mongos using command mongos --configdb "configserverreplica/cfg1:27019, cfg2:27019, cfg3:27019" --bind_ip_all —port 27020.

  4. from client machine I connect to foreign-connector with mongo --host foreign-connector --port 27020

Above is my set up. And it works perfectly fine for failover test (I can take down any node at a given time... Everything works)

My question is what happens when mongos server (foreign-connector) goes down.
Is there any other way to be failover proof.

Thanks for your help is advance.

  • what is MongoDB version(x,y,z)? Aug 2, 2018 at 6:11
  • mongodb 4.0.0 (MongoDB Community Edition)
    – maswadkar
    Aug 2, 2018 at 13:01

1 Answer 1


what if mongos server goes down in shard cluster setup

As per MongoDB documentation here mongos for “MongoDB Shard,” is a routing service for MongoDB shard configurations that processes queries from the application layer, and determines the location of this data in the sharded cluster, in order to complete these operations. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.

My question is what happens when mongos server (foreign-connector) goes down.

if mongos server will goes down then config servers connection will be lost with mongos server. Then each shard in cluster connection will be lost.

As per MongoDB documentation here Enable sharding for a database to proceed, you must be connected to a mongos associated to the target sharded cluster.

For your further ref here

  • I have another question... does that mean I can have multiple mongos routing services running which will route to my mongodb shard viz mongodbreplicaset
    – maswadkar
    Aug 2, 2018 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.