Q37: What is a Replica Set in MongoDB? Explain Primary, Secondary, and Arbiter nodes.

A Replica Set is a group of mongod instances that maintain the same data set for high availability and redundancy:

  • Primary Node: Receives all write operations.
  • Secondary Nodes: Replicate the Primary's oplog and apply operations asynchronously. Can serve read queries.
  • Arbiter Node: Holds no data; participates strictly in elections to break tie votes.
Key Takeaways
  • Ensures automatic failover and redundancy.
  • Contains 1 Primary and 1+ Secondary nodes.
Knowledge Check

What is the primary role of an Arbiter node in a MongoDB Replica Set?