MongoDB Questions and Answers – Troubleshooting

«
»

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

1. _________ prevents the current member from seeking election as primary for a period of time.
a) replSetGetStatus
b) replSetFreeze
c) replSetInitiate
d) all of the mentioned
View Answer

Answer: b
Explanation: The replSetFreeze command prevents a replica set member from seeking election for the specified number of seconds.

2. Point out the wrong statement.
a) Primary capture data from the primary member to maintain an up to date copy of the sets’ data
b) For some deployments, implementing a custom replication sync topology may be more effective than the default sync target selection logic
c) MongoDB provides the ability to specify a host to use as a sync target
d) None of the mentioned
View Answer

Answer: d
Explanation: However, by default secondaries may automatically change their sync targets to secondary members based on changes in the ping time between members and the state of other members’ replication.

advertisement

3. ________ returns a document that reports on the status of the replica set.
a) replSetGetStatus
b) replSetFreeze
c) replSetInitiate
d) all of the mentioned
View Answer

Answer: a
Explanation: The replSetGetStatus command returns the status of the replica set from the point of view of the current server.

4. __________ enables or disables a maintenance mode, which puts a secondary node in a RECOVERING state.
a) replSetReconfig
b) replSetMaintenance
c) replSetStepDown
d) all of the mentioned
View Answer

Answer: b
Explanation: The replSetMaintenance admin command enables or disables the maintenance mode for a secondary member of a replica set.

Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
advertisement

5. Point out the correct statement.
a) To affect the sync target for the initial sync, run rs.syn() operation before initial sync
b) If you run rs.syncFrom() during initial sync, MongoDB produces no error messages
c) replSetSyncFrom and rs.syncFrom() provide a permanent override of default behavior
d) All of the mentioned
View Answer

Answer: b
Explanation: The sync target falls more than 30 seconds behind another member of the replica set; the mongod will revert to the default sync target.

6. When enabled replSetMaintenance: true, the member enters the ________ state.
a) REPLICATING
b) RECOVERING
c) STALE
d) All of the mentioned
View Answer

Answer: b
Explanation: The member is not accessible for read operations.

Take MongoDB Mock Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
advertisement

7. ________ applies a new configuration to an existing replica set.
a) replSetReconfig
b) replSetMaintenance
c) replSetStepDown
d) all of the mentioned
View Answer

Answer: a
Explanation: The replSetReconfig command modifies the configuration of an existing replica set.

8. Which of the command is for master-slave replication only?
a) replSetSyncFrom
b) resync
c) applyOps
d) isMaster
View Answer

Answer: b
Explanation: resync forces a mongod to re-synchronize from the master.

advertisement

9. _______ is an internal command that applies oplog entries to the current data set.
a) replSetSyncFrom
b) resync
c) applyOps
d) isMaster
View Answer

Answer: c
Explanation: The applyOps command is primarily an internal command.

10. __________ explicitly override the default logic for selecting a member to replicate from.
a) replSetSyncFrom
b) resync
c) applyOps
d) isMaster
View Answer

Answer: a
Explanation: replSetSyncFrom explicitly configures which host the current mongod pulls oplog entries from.

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 & technical discussions at Telegram SanfoundryClasses.