mongodb中,会从副本中读数据吗?

ibuler 发布于 2013/04/19 15:56
阅读 316
收藏 0

前端三个route: mongos1 mongos2 mongs3

中间三个config: config1 config 2 config 3

后端三个replset: rs1,rs2,rs3

rs1三个节点:rs1_1 rs1_2 rs1_3

rs2三个节点:rs2_1 rs2_2 rs2_3

rs2三个节点:rs3_1 rs3_2 rs3_3

一个sharding后的collection比如test.users,读取它会从rs1.rs2.rs3中在secondary中读取吗?

加载中
0
用户名已存在
用户名已存在

看你的数据库连接参数了。

MongoReplicaSetClient:

  • 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.


我觉得即使是分片,对于一个特定的复制集,这些参数应该还是有效的

ibuler
ibuler
Thank you! 各人感觉也应该支持,否则资源太浪费了
0
猪猪
猪猪

使用时加入 slaveOkay 

0
仪山湖
仪山湖
默认配置下会
返回顶部
顶部