MongoDB Questions and Answers – Sharded Cluster Data Management – 2

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

Answer: b
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

Answer: a
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

Answer: c
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

Answer: c
Explanation: flushRouterConfig clears the current cluster information cached by a mongos instance and reloads all sharded cluster metadata from the config database.

advertisement
advertisement

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

Answer: d
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

Answer: a
Explanation: checkShardingIndex is an internal command that supports sharding functionality.

Note: Join free Sanfoundry classes at Telegram or Youtube

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

Answer: a
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

Answer: b
Explanation: listShards is only available for mongos instances.

advertisement

9. _________ is an internal command that supports the sharding functionality.
a) getBalancerHost()
b) getShardMap
c) enableSharding()
d) all of the mentioned
View Answer

Answer: b
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

Answer: b
Explanation: The isdbgrid command is not available to mongod.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.