Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

We think about moving from a master-slaves to 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...).

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
If i understand this correctly, it is only writing with one of the servers within the replica-set, but i do not have to care which one is the master? mongodb master-slaves do manage and failover or sync themselves, really possible? how inconvenient was mysql... –  ledy Jun 21 '12 at 6:53
    
correct, the drivers keep track of which is primary and send writes to that one (and reads unless you specify slaveOk for the read). And automatic failover happens as long as the majority of the replica set is up. –  Asya Kamsky Jun 21 '12 at 12:13
    
Trying the master slave replication by editing the config seems to work. But how can it automatically failover the master with the "hard-coded", strictly defined master=true/false in the config file on each mongos? –  ledy Jun 21 '12 at 14:51
    
You need to use proper replica set configuration, not master/slave. See this page mongodb.org/display/DOCS/… –  Asya Kamsky Jun 21 '12 at 22:58
add comment

It pretty much like "write and sync the others like a master-master farm". as MongoDB docs said "Replica sets are a form of asynchronous master/slave replication, adding automatic failover and automatic recovery of member nodes." Please check http://www.mongodb.org/display/DOCS/Replica+Sets

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.