principleMinor
MongoDB: Replica Set - master vs. slave
Viewed 0 times
replicaslavemongodbmasterset
Problem
We think about moving from a master-slaves to
Now I wonder if
This might reduce the single source of error (
MongoDB with replica-set.Now I wonder if
MongoDB replicas are also set up like read-only slaves or if each mongos is able to write and sync the others like a master-master farm?This might reduce the single source of error (
master down) and also balance the write-load for scaling with best performance (not only for read, but also write...).Solution
A replica set can only have one primary at any particular time (one master) with the other nodes being secondaries (slaves) and so they are nothing like master-master (i.e. multi-master) replication.
You definitely should move to a replica set from master/slave configuration because that is the preferred and recommended way to replicate. From MongoDB docs: "replica sets are a functional superset of master/slave, and newer, more robust code".
When a primary fails, one of the secondaries will be automatically elected as a new primary (you can see the docs to see the details of how that happens).
You cannot get write balancing from having a replica set - you can only distribute writes by sharding in MongoDB.
You definitely should move to a replica set from master/slave configuration because that is the preferred and recommended way to replicate. From MongoDB docs: "replica sets are a functional superset of master/slave, and newer, more robust code".
When a primary fails, one of the secondaries will be automatically elected as a new primary (you can see the docs to see the details of how that happens).
You cannot get write balancing from having a replica set - you can only distribute writes by sharding in MongoDB.
Context
StackExchange Database Administrators Q#19546, answer score: 6
Revisions (0)
No revisions yet.