C100DBA practice question 7 of 25

In a sharded replicas set environment with multiple mongos servers, which of the following would decide the mongos failover?

Full set: 130 questions
Answer options
A: mongos
B: mongo shell
C: individual language drivers Correct answer
D: mongod
Correct Answer:
C. individual language drivers
Explanation

mongos instances are stateless routers in a sharded cluster. They do not have an internal failover or election mechanism among themselves. High availability for the routing tier is achieved at the application level. The application's MongoDB driver is configured with a list of all mongos hosts. If the driver cannot connect to one mongos, it will automatically try to connect to the next one in the list, thereby handling the failover. This responsibility lies entirely with the client-side driver, not any server-side component.

Why Incorrect

A. A mongos instance is independent and stateless; it does not participate in or decide the failover of other mongos instances.
B. The mongo shell is a client application. Like other clients, it connects to a mongos but does not manage cluster-wide failover.
D. mongod processes (config servers or shard members) manage their own replica set failover but are not involved in mongos failover.

References

1. MongoDB Manual, Sharding, Sharded Cluster Components, mongos: "Clients connect to a mongos, which routes queries to the appropriate shards... You can run multiple mongos instances to balance the client request load. The client can connect to any mongos."

2. MongoDB Manual, Connection String URI Format, "Connect to Multiple mongos Instances": "To connect to multiple mongos instances, specify the hosts in the connection string. The driver or mongo shell will automatically attempt to connect to another mongos if it cannot reach the first one in the list."

Scroll to Top