简体   繁体   中英

mongodb write concern for sharded cluster

From the mongodb docs:

mongos uses "majority" for the write concern of the shardCollection command and its helper sh.shardCollection().

In replica sets majority is Nodes/2 and round up.

Is it the majority of the config servers or what exactly?

I guess mongo doesn't specify very specifically what happens. 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."

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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