MongoDB Questions and Answers – Sharding Mechanics

«
»

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Sharding Mechanics”.

1. The _________ process is responsible for redistributing the chunks of a sharded collection evenly among the shards for every sharded collection.
a) Balancer
b) Sharder
c) Replicator
d) All of the mentioned
View Answer

Answer: a
Explanation: By default, the balancer process is always enabled.

2. Point out the correct statement.
a) Splitting is the process MongoDB uses to distribute data of a sharded collection evenly across a sharded cluster
b) Any mongos instance in the cluster can start a balancing round
c) When a shard has too many of a sharded collection’s chunks compared to other shards, MongoDB splits balances the chunks across the shards
d) All of the mentioned
View Answer

Answer: b
Explanation: When a balancer process is active, the responsible mongos acquires a “lock” by modifying a document in the lock collection in the Config Database.

advertisement

3. Use _______ migration to distribute data during bulk inserts.
a) automatic
b) manual
c) temporary
d) all of the mentioned
View Answer

Answer: b
Explanation: Shard keys are immutable and cannot be changed after insertion.

4. The balancer process sends the _______ command to the source shard.
a) moveChunkShard
b) migChunk
c) moveChunk
d) all of the mentioned
View Answer

Answer: c
Explanation: The source starts the move with an internal moveChunk command.

advertisement
advertisement

5. Point out the wrong statement.
a) When fully synchronized, the destination shard connects to the config database and updates the cluster metadata with the new location for the chunk
b) The destination shard builds any indexes required by the source that do not exist on the destination
c) The destination shard begins requesting documents in the chunk and starts receiving copies of the data
d) None of the mentioned
View Answer

Answer: d
Explanation: After the destination shard completes the update of the metadata, and once there are no open cursors on the chunk, the source shard deletes its copy of the documents.

6. The source shard is responsible for incoming ______ operations for the chunk.
a) read
b) write
c) read-write
d) all of the mentioned
View Answer

Answer: b
Explanation: During the migration process, operations to the chunk route to the source shard.

advertisement

7. ________ can alter the behavior so that the delete phase of the current migration blocks the start of the next chunk migration.
a) _waitForUpdate
b) _waitForDelete
c) _waitForInsert
d) All of the mentioned
View Answer

Answer: b
Explanation: The _waitForDelete is generally for internal testing purposes.

8. The default value _________ becomes true for all chunk migrations.
a) secThrottle
b) secondaryThrottle
c) primaryThrottle
d) all of the mentioned
View Answer

Answer: b
Explanation: The new writeConcern field in the balancer configuration document allows you to specify a write concern semantics the _secondaryThrottle option.

advertisement

9. You can set the _________ option on the balancer configuration to set different write concern semantics.
a) writeConcern
b) updateConcern
c) readConcern
d) all of the mentioned
View Answer

Answer: a
Explanation: By default, each document operation during chunk migration propagates to at least one secondary before the balancer proceeds with the next document

10. With __________ enabled, the source shard archives the documents in the migrated chunks in a directory named after the collection namespace.
a) sharding.archiveChunks
b) sharding.archiveMovedChunks
c) shard.archiveMovedChunks
d) none of the mentioned
View Answer

Answer: b
Explanation: Starting in MongoDB 2.6, sharding.archiveMovedChunks is enabled by default.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Reference Books in MongoDB.

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!
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter