Does MonogDB supports replication where I have many machines with MongoDB that have different data and I want to replicate this data to one, and only one MongoDB?


By the literal interpretation of your question, this can't be done. A secondary/slave cannot be secondary/slave to multiple MongoDB instances.

However, what you could do (and still is far from ideal and not recommended in production) is set up multiple MongoDB masters, each with one slave. These slaves all reside on the one server but each runs on a different port, thus giving you multiple MongoDBs but all on the one server. Master/slave is described here.

There will undoudtedly be memory and i/o issues but it could (in theory) be configured.


Although I havn't tested it, you should be able to add one node to multiple replica sets. Be careful that none of your replicasets share the same databases as this may screw up your "backup" node. Same applies to your collections within a database (Maybe MongoDB even disallows this, but I'm not sure.).

Anyway I'm not so sure if you should replicate multiple nodes to one as this would cause huge load on the single backup node. Why do you want exactly one Node to replicate to? Maybe you want to take a look at this: https://github.com/micahwedemeyer/automongobackup.

  • I think about transfering/merge many MongoDB databases into one. I have many machines with local MongoDB and one client that need pull data from all. So I wonder if could be easier if client pull data from one local database that have data from others – userbb May 12 '12 at 18:08
  • Hmm I'm not sure if MongoDB is the right choice then. You may consider to use couchdb in that case as this is written for distributed dbs which are located at several not always connected systems. mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB but other requirements of your application may prefer mongodb... Please check this link and CouchDB to see if this would fit better. – philnate May 12 '12 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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