Suggest an editImprove this articleRefine the answer for “What is a Replica Set?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A Replica Set in MongoDB is a cluster of several servers that hold the same copy of data and automatically switch over on failures, providing high availability and fault tolerance: it consists of a Primary (accepts writes), Secondaries (copy the data), and an optional Arbiter (takes part in voting but holds no data). **Key point:** if the Primary fails, the remaining nodes hold an election, pick a new Primary, and the cluster keeps running with no manual intervention - this is called auto-failover.Shown above the full answer for quick recall.Answer (EN)ImageA Replica Set in MongoDB is **a cluster of several servers that hold the same copy of data and automatically switch over on failures**, providing high availability and fault tolerance. ### What a Replica Set is made of The set usually includes: | Node | Role | |---|---| | Primary | accepts all write operations and the main queries | | Secondary | copies data from Primary and serves as a backup | | Arbiter (optional) | takes part in voting, but holds no data | Secondaries can also be used for reads, if allowed by the settings (`readPreference`), which helps take load off Primary. ### How fault tolerance works 1. Primary fails 2. The remaining nodes run an **election** 3. They vote and pick a new Primary 4. The cluster keeps running with no manual intervention This is called **auto-failover**. ### Why a Replica Set is used - **High availability (HA)**, the database doesn't go down when a node fails - **Read scaling**, read requests can be pointed at Secondary - **Data protection**, several copies keep the data up to date - **The option for geo-distribution**, nodes can live in different data centers ### Summary A Replica Set is a MongoDB mechanism where several nodes hold identical data and automatically maintain the system's availability and consistency, even through failures. It's the foundation of MongoDB's fault-tolerant, production clusters.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.