Docs HomeMongoDB Manual

Hedged Read Option对冲突取选项

Starting in MongoDB 4.4 for sharded clusters, you can specify the use of hedged reads for non-primary read preferences.从MongoDB 4.4中针对分片集群开始,您可以为非primary读取偏好指定对冲读取的使用。

With hedged reads, the mongos instances can route read operations to two replica set members per each queried shard and return results from the first respondent per shard.通过对冲读取,mongos实例可以将读取操作路由到每个查询的分片的两个副本集成员,并返回每个分片的第一个响应者的结果。

Hedged reads are supported for the following operations:对冲读取支持以下操作:

To specify hedged read for a read preference, MongoDB 4.4 introduces the hedged read option for read preferences.为了为读取偏好指定对冲读取,MongoDB 4.4为读取偏好引入了对冲读取选项。

Enable Hedged Reads启用对冲读取

To use hedged reads, enable the hedge read option for non-primary read preferences. 要使用对冲读取,请为非primary读取首选项启用对冲读取选项。Read preference nearest specifies hedged read by default.读取首选项nearest指定默认情况下的对冲读取。

Additional Information附加信息

For more information on hedged reads, see Hedged Reads.有关对冲读取的更多信息,请参阅对冲读取

Member Selection with Hedged Reads对冲读取的会员选择

For details on member selection for hedged reads, see Read Preference and Shards.有关对冲读取的成员选择的详细信息,请参阅读取偏好和分片

Hedged Reads Diagnostics套期保值读取诊断

The command serverStatus and its corresponding mongosh method db.serverStatus() return hedgingMetrics.命令serverStatus及其相应的mongosh方法db.serverStatus()返回hedgingMetrics