简体   繁体   English

mongodb 写关注分片集群

[英]mongodb write concern for sharded cluster

From the mongodb docs: 从 mongodb 文档:

mongos uses "majority" for the write concern of the shardCollection command and its helper sh.shardCollection(). mongos 对 shardCollection 命令及其助手 sh.shardCollection() 的写关注使用“多数”。

In replica sets majority is Nodes/2 and round up.在副本集中,大多数是Nodes/2并向上取整。

Is it the majority of the config servers or what exactly?它是大多数配置服务器还是究竟是什么?

I guess mongo doesn't specify very specifically what happens.我猜 mongo 没有具体说明会发生什么。 If you dug one more page down, Write Concern , you'll read that "In sharded clusters, mongos instances will pass the write concern on to the shards."如果再往下翻一页, 写关注,你会读到“在分片集群中,mongos 实例会将写关注传递给分片。”

Assuming your shard cluster is also a replica set eg PSS (primary-secondary-secondary) it should follow the same behavior as if you only had a single unsharded replica set.假设您的分片集群也是一个副本集,例如 PSS(主要-次要-次要),它应该遵循与您只有一个未分片的副本集相同的行为。 "For this replica set, calculated majority is two, and the write must propagate to the primary and one secondary to acknowledge the write concern to the client". “对于这个副本集,计算出的多数是两个,并且写入必须传播到主要和一个次要以向客户端确认写入问题”。 The client here technically being mongos .这里的客户在技术上是mongos

The other shard clusters do not need to acknowledge the write if they are not being written to.如果其他分片集群没有被写入,则不需要确认写入。 If you are writing to multiple shard clusters, then I'd assume both shard clusters need to ack the write similarly.如果您要写入多个分片集群,那么我假设两个分片集群都需要类似地确认写入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM