read_preference 的选项里面,
PRIMARY: Queries are sent to the primary of the replica set.
PRIMARY_PREFERRED: Queries are sent to the primary if available, otherwise a secondary.
SECONDARY: Queries are distributed among secondaries. An error is raised if no secondaries are available.
SECONDARY_PREFERRED: Queries are distributed among secondaries, or the primary if no secondary is available.
NEAREST: Queries are distributed among all members.
最符合的似乎是 NEAREST , 但是实测只是读了本机的 MongoDB ,另外一台机器的完全空闲。。。
难道我要手动建立 2 个 MongoClient 然后随机查询某个库么。。。
PRIMARY: Queries are sent to the primary of the replica set.
PRIMARY_PREFERRED: Queries are sent to the primary if available, otherwise a secondary.
SECONDARY: Queries are distributed among secondaries. An error is raised if no secondaries are available.
SECONDARY_PREFERRED: Queries are distributed among secondaries, or the primary if no secondary is available.
NEAREST: Queries are distributed among all members.
最符合的似乎是 NEAREST , 但是实测只是读了本机的 MongoDB ,另外一台机器的完全空闲。。。
难道我要手动建立 2 个 MongoClient 然后随机查询某个库么。。。