MongoDB Questions and Answers – Replication Maintenance

«
»

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

1. _________ shut down the mongod instance for one of the non-primary members of your replica set.
a) db.shutdown()
b) db.shutdownServer()
c) db.shutServer()
d) all of the mentioned
View Answer

Answer: b
Explanation: Restart this mongod as a standalone instance running on a different port and without the –replSet parameter.

2. Point out the wrong statement.
a) To change the size of the oplog, you must perform maintenance on each member of the replica set in turn
b) Always start rolling replica set maintenance with the secondaries, and finish with the maintenance on primary member
c) The oplog exists internally as a capped collection
d) None of the mentioned
View Answer

Answer: d
Explanation: In most cases the default oplog size is an acceptable size; however, in some situations you may need a larger or smaller oplog.

advertisement

3. To finish the rolling maintenance operation, step down the primary with the _________ method.
a) rs.syncFrom()
b) rs.stepDown()
c) rs.synchrepl()
d) secondary
View Answer

Answer: b
Explanation: The replica set member will recover and “catch up” before it is eligible for election to primary.

4. You also can force a member never to become primary by setting its priority value to ___________
a) 1
b) 2
c) 3
d) 0
View Answer

Answer: d
Explanation: You can force a replica set member to become primary by giving it a higher priority value than any other member in the set.

advertisement
advertisement

5. Point out the correct statement.
a) Replica sets allow a MongoDB deployment to remain available during the majority of a maintenance window
b) Always start mongod with the same user, even when restarting a replica set member as a standalone instance
c) The secondary takes time to catch up to the primary
d) All of the mentioned
View Answer

Answer: d
Explanation: From the mongo shell, use the rs.status() command to verify that the member has caught up from the RECOVERING state to the SECONDARY state.

6. A replica set member becomes _________ when its replication process falls so far behind that the primary overwrites oplog entries the member has not yet replicated.
a) stale
b) state
c) dead
d) secondary
View Answer

Answer: a
Explanation: When this occurs, you must completely resynchronize the member by removing its data and performing an initial sync.

advertisement

7. During initial sync, mongod will remove the content of the _______
a) dbPathSync
b) Path
c) dbPath
d) none of the mentioned
View Answer

Answer: c
Explanation: You can also force a mongod that is already a member of the set to perform initial sync by restarting the instance without the content of the dbPath.

8. You cannot use a _________backup for the data files, only a snapshot backup.
a) mongorestore
b) mongodump
c) bsondump
d) rs.syncFrom()
View Answer

Answer: b
Explanation: If copying data files, you must copy the content of the local database.

advertisement

9. You can use the ________ setting in Replica Set Configuration to disable chained replication for situations where chained replication is causing lag.
a) chainingAllowed
b) chainingDisAllowed
c) chainingAllow
d) none of the mentioned
View Answer

Answer: a
Explanation: MongoDB enables chained replication by default.

10. For most replica sets, the hostnames in the _________ field never change.
a) tag
b) host
c) rs
d) none of the mentioned
View Answer

Answer: b
Explanation: Always use resolvable hostnames for the value of the host field in the replica set configuration to avoid confusion and complexity.

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