Mongos dedicated to route only on secondary nodes of cluster

Hello MongoDB Folk,

I am looking for some inputs and thoughts on reading only from Secondary through dedicated mongos.

Is there any way to route all queries particularly from mongos that will read data only from secondary nodes of sharded cluster and no write will be entertained.

To achieve this below are the tools I am aware of and that too comes with a lot of constraints like no support on index sync and requires a lot of manual interventions in order to manage and replicate a whole new cluster.

mongo-connector and seems no more active: https://github.com/yougov/mongo-connector
mongo-shake - Documentation is not much clear: https://github.com/alibaba/MongoShake

This is the improvement request I have submitted in MongoDB
https://jira.mongodb.org/browse/SERVER-52536
If the above improvement seems useful then please up-vote and any other tools or utility recommendations are most welcome.

I am not sure what your use-case for this. If to improve performances of the whole system you may want to consider that secondaries have the same workload as the primary. They performed the same amount of writes. So you might not see a lot of differences.

Before going to the complex route of having dedicated mongos, I would look at
https://docs.mongodb.com/manual/reference/read-concern/
and
https://docs.mongodb.com/manual/core/read-preference/
for normal read workload as they may satisfy your use-case.

If you want mongos for reporting or analytic workload, you may consider https://www.developer.com/db/make-mongodb-replica-sets-work-for-analytics-without-compromising-availability.html

1 Like