what if mongos server goes down in shard cluster setup

Posted on

Question :

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.

Answer :

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

Leave a Reply

Your email address will not be published. Required fields are marked *