mongodb single DB replication

I don't believe it is possible.

Unlike sharding, where you specify down to the collection level what gets sharded, with replica sets you're defining that a given MongoDB instance is part of a replica set. As only one node in a replica set can be the master at any given time, based on the scenario you are talking about, then there would be a problem if e.g. Server1 went down and Server3 was promoted to master - as DB2 would then not be able to be written to.


I had a simliar problem and found a quite easy solution in javascript to be executed in a mongo-shell.

Sourcecode available here: http://www.suenkel.de/blog/2012/02/mongodb-replicate-one-database-or-collection/

With opening a tailable cursor on the oplog of the master server each operation could be applied to another server (of course you can filter by the namespace of the collections or even the databases...)