This document provides an overview of MongoDB replica sets. It discusses the key concepts including primary nodes, secondary nodes, elections, write acknowledgments, failovers, topologies, configuration, and commands. Replica sets improve availability, durability, and performance compared to single node deployments. A replica set consists of multiple MongoDB instances that maintain the same data set. One node is selected as the primary that handles all write operations, while secondaries replicate the primary.
6. E,6%*%/.5'()*+
> // master
> use local
> db.printReplicationInfo()
> db.slaves.find()
> db.oplog.$main.findOne()
// slave
> use local
> db.printSlaveReplicationInfo()
7. Y)#)$)2%"/+
M->S
M->S
->S
->S
M->S(db1)
->S(db2)
…
M->S
->delayed_S
M->S one machine can back up many
M-/ (if it has enough resources)
M<->M *very limited –
best for experiments
And Replica Sets (see below)