Mongo.setReadPref(mode, tagSet) primaries and secondaries are treated equivalently. 读优先级策略

 

https://docs.mongodb.com/manual/reference/method/Mongo.setReadPref/#Mongo.setReadPref

Mongo.setReadPref(mode, tagSet)

Call the setReadPref() method on a Mongo connection object to control how the client will route all queries to members of the replica set.

ParameterTypeDescription
mode string One of the following read preference modes: primaryprimaryPreferred,secondarysecondaryPreferred, or nearest.
tagSet array Optional. A tag set used to specify custom read preference modes. For details, see Tag Sets.

 

https://docs.mongodb.com/manual/reference/read-preference/#nearest

The driver reads from a member whose network latency falls within the acceptable latency window. Reads in the nearest mode do not consider whether a member is a primary or secondary when routing read operations: primaries and secondaries are treated equivalently. The read preference member selectiondocumentation describes the process in detail.

 

 

 

 

posted @ 2017-11-22 10:29  papering  阅读(273)  评论(0编辑  收藏  举报