2

I have a Mongo DB setup of 4 DB (2 shards of 2 replica) and I noticed that the secondary servers of each shard is not being used for read queries. Both secondary servers received all inserts, updates and deletes from their master but when I look at mongostat, the number under 'query' is always zero.

Do I need to setup something such as 'slaveOk' for my mongos client to be able to use the secondary server of each shard for read queries?

Thanks!

1 Answer 1

3

Reading from the slaves is not the default behavior, but it is enabled in the application via the language driver (because they can only be used on read operations.) It is not controllable from the server. An example in pymongo is described in the master_slave_connection page.

1
  • The answer was indeed to enable the slaveOk option in my driver, even in a sharded environment.
    – Pierre
    Jan 9, 2015 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .