Search code examples
mongodbreplicationnosql

Configure a Mongo replica set to only replicate certain collections


I have a ~3GB mongo database with several dozen collections. Three of these collections handle ~300 queries per second, while the rest sustain a much lower volume. I expect the traffic to continue to grow quickly.

I'd like to set up a replica set to handle the high-traffic collections. It isn't necessary for this new instance to replicate the rest of the database. Is this possible?


Solution

  • Seems like not possible at the moment by built-in features of mongodb and only way to do is to come up with your own manual replication algorithm or use some other tools written by third parties.

    https://github.com/wordnik/wordnik-oss project might help you to achieve this according to the following post.

    https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/Ap9V4ArGuFo

    Describes workaround to filter documents in replication.

    Replicate only documents where {'public':true} in MongoDB

    Or just replicate the data yourself manually which might worth trying.

    Good luck.