This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Sharded Cluster Data Management – 2”.
1. _______ enables the balancer and waits for balancing to start.
a) sh.waitForBalancer()
b) sh.startBalancer()
c) sh.waitForDLock()
d) all of the mentioned
View Answer
Explanation: sh.waitForDLock() waits for a specified distributed sharded cluster lock.
2. Point out the correct statement.
a) sh.deadForDLock() waits for a specified distributed sharded cluster lock
b) sh.waitForBalancerOff() waits until the balancer stops running
c) sh.statusserver() reports on the status of a sharded cluster, as db.printShardingStatus()
d) all of the mentioned
View Answer
Explanation: sh.stopBalancer() disables the balancer and waits for any in progress balancing rounds to complete.
3. _________ waits for a change in ping state from one of the mongos in the sharded cluster.
a) sh.waitForBalancer()
b) sh.startBalancer()
c) sh.waitForPingChange()
d) all of the mentioned
View Answer
Explanation: sh.waitForBalancer() waits for the balancer state to change.
4. _______ forces an update to the cluster metadata cached by a mongos.
a) config
b) flushconf
c) flushRouterConfig
d) all of the mentioned
View Answer
Explanation: flushRouterConfig clears the current cluster information cached by a mongos instance and reloads all sharded cluster metadata from the config database.
5. Point out the wrong statement.
a) moveChunks provides the ability to combine chunks on a single shard
b) setShardVersion is used to set the config server version
c) shardCollection enables the sharding functionality for a collection, allowing the collection to be sharded
d) none of the mentioned
View Answer
Explanation: For a sharded collection, mergeChunks combines contiguous chunk ranges on a shard into a single chunk.
6. Which of the following command that validates index on shard key?
a) checkShardingIndex
b) checkSIndex
c) enableSharding
d) all of the mentioned
View Answer
Explanation: checkShardingIndex is an internal command that supports sharding functionality.
7. Which of the following command is used to determine split points?
a) splitVector
b) medianKey
c) movePrimary
d) none of the mentioned
View Answer
Explanation: movePrimary reassigns the primary shard when removing a shard from a sharded cluster.
8. You can only issue listShards against the ________ database.
a) local
b) admin
c) temp
d) none of the mentioned
View Answer
Explanation: listShards is only available for mongos instances.
9. _________ is an internal command that supports the sharding functionality.
a) getBalancerHost()
b) getShardMap
c) enableSharding()
d) all of the mentioned
View Answer
Explanation: sh.getBalancerHost() returns the name of a mongos that’s responsible for the balancer process.
10. ________ command verifies that a process is a mongos.
a) medianKey
b) isdbgrid
c) movePrimary
d) none of the mentioned
View Answer
Explanation: The isdbgrid command is not available to mongod.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Practice Programming MCQs
- Apply for Programming Internship
- Check Information Technology Books
- Check MongoDB Books