0
0
MongoDBquery~5 mins

Mongos router behavior in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the primary role of a mongos in a MongoDB sharded cluster?
The mongos acts as a query router. It directs client requests to the correct shard(s) based on the cluster's metadata, making the sharding transparent to the client.
Click to reveal answer
intermediate
How does mongos know which shard to send a query to?
Mongos uses the cluster metadata stored in the config servers to determine the shard that holds the data for the query's shard key range.
Click to reveal answer
beginner
True or False: mongos stores data itself in a sharded cluster.
False. Mongos does not store data. It only routes queries to the appropriate shards which hold the actual data.
Click to reveal answer
advanced
What happens if a mongos instance loses connection to the config servers?
Mongos cannot route queries correctly without config server metadata. It will fail to process queries until it reconnects and refreshes metadata.
Click to reveal answer
intermediate
Why might you run multiple mongos instances in a sharded cluster?
Running multiple mongos instances improves availability and load balancing for client requests, preventing a single point of failure or bottleneck.
Click to reveal answer
What is the main function of a mongos router in MongoDB?
ABackup shard data
BRoute queries to the correct shard
CManage config server metadata
DStore data in the cluster
Where does mongos get the metadata to route queries?
AFrom the config servers
BFrom the shards directly
CFrom the client application
DFrom the mongod instances
If mongos loses connection to config servers, what happens?
AIt continues routing queries normally
BIt stores data locally
CIt automatically becomes a config server
DIt cannot route queries correctly
Does mongos store any data in a sharded cluster?
ANo, it only routes queries
BYes, it stores metadata only
CYes, it stores all data
DNo, it stores backups
Why run multiple mongos instances?
ATo replace config servers
BTo store more data
CTo improve query routing availability
DTo shard data
Explain how mongos routes a client query in a MongoDB sharded cluster.
Think about how mongos acts like a traffic controller.
You got /4 concepts.
    Describe what happens if a mongos instance cannot access the config servers.
    Consider the importance of config server metadata for routing.
    You got /4 concepts.