Hedged Read Option
重要
MongoDB 8.0以降、ヘッジされた読み取りは非推奨です。 読み込み設定(read preference nearest
を指定するクエリは、デフォルトでヘッジされた読み取りを使用しなくなりました。 ヘッジされた読み取りを明示的に指定すると、MongoDB はヘッジされた読み取りを実行し、警告をログに記録します。
You can specify the use of hedged reads for
non-primary
read preferences on sharded
clusters.
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.
ヘッジされた読み取りは、以下の操作でサポートされています。
To specify hedged read for a read preference, use the hedged read option for read preferences.
Enable Hedged Reads
To use hedged reads, enable the hedge read option for non-primary
read preferences.
When using the drivers, refer to the drivers' read preference API.
When using
mongosh
, you can use the helper methodscursor.readPref()
andMongo.setReadPref()
.
詳細情報
For more information on hedged reads, see ヘッジされた読み取り.
Member Selection with Hedged Reads
For details on member selection for hedged reads, see 読み込み設定(read preference)とシャード.
ヘッジされた読み取りの診断
コマンドserverStatus
とそれに対応するmongosh
メソッドdb.serverStatus()
はhedgingMetrics
を返します。