replication and sharding in mongodb Flashcards
replica set
has one primary and multiple secondary and all write operations must go to the primary which maintains a log; “oplog”
secondaries periodically read and apply the log from the primary site
what are some benefits of replica sets
allows flexibility availability and load balancing and fault tolerance
what are replica sets based on
based on master slave architecture
how does writing and reading work in replica sets
all writes go to the primary
writes are accepted once the primary accepts the operation in memory
the secondaries are not updated yet
all reads go to the primary ensuring strict consitency
how does persistent writing (journaling/logging) work in replica sets
a write is only accepted after being written to a log on disk
still on the primary site
accepted data becomes persistent