php mongodb类 setreadpreference,PHP - Manual: MongoDB\Driver\ReadPreference::__construct (官方文档)...

本文详细介绍了MongoDB驱动程序中的最大复制延迟设置,该设置允许指定从副本集次级节点读取的最大可接受延迟。当次级节点的延迟超过设定值时,驱动程序将停止使用它进行读操作。此选项要求MongoDB 3.4+版本,并且不适用于 PRIMARY 模式。同时,设置最大延迟还需要所有部署中的MongoDB实例都符合版本要求,否则执行时会抛出异常。
摘要由CSDN通过智能技术生成

Specifies a maximum replication lag, or "staleness", for reads from

secondaries. When a secondary's estimated staleness exceeds

this value, the driver stops using it for read operations.

If specified, the max staleness must be a signed 32-bit integer

greater than or equal to

MongoDB\Driver\ReadPreference::SMALLEST_MAX_STALENESS_SECONDS.

Defaults to

MongoDB\Driver\ReadPreference::NO_MAX_STALENESS,

which means that the driver will not consider a secondary's lag

when choosing where to direct a read operation.

This option is not compatible with the

MongoDB\Driver\ReadPreference::RP_PRIMARY mode.

Specifying a max staleness also requires all MongoDB instances in

the deployment to be using MongoDB 3.4+. An exception will be thrown

at execution time if any MongoDB instances in the deployment are of

an older server version.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值