Mongo DB write operation in shard setting

时间:2016-02-03 04:13:58

标签: mongodb

I am new to mongoDB while going through some tutorial I got a question in my mind that, in sharded environment during reading operation "mongos" first checks config server to get details to which shard it has to query. But what about during write operation does it first checks to which shard it has to perform write operation?

Thanks in advance, Kitty

1 个答案:

答案 0 :(得分:0)

我将根据MongoDB v3.2的当前稳定版本回答。

config servers将群集的元数据存储在配置数据库中。 mongos实例缓存此数据并使用它将读取写入分片。

MongoDB仅在元数据更改时将数据写入配置服务器,例如:

在以下情况下,MongoDB从配置服务器读取数据:

  • 新的mongos第一次启动,或现有的mongos重启。
  • 更改群集元数据后,例如在块迁移之后。

另请参阅:Sharded Cluster Mechanics