简体   繁体   中英

Setting a mongodb instance's maximum lag for slaveOk reads

I perform slaveOk reads on a mongo (2.0.3) secondary.

I wish to do so, but only if the data is not "too" stale. If it is, I'd rather the connection failed.

I don't wish to make the opLog small as I don't to force a full resync.

Ideally I'd like the instance to be in Recovering/similar state until its caught up beyond my own threshold.

Is there any built-in config parameter for this, or would I be forced to poll replSetGetStatus to see how far behind it is?

Thanks!

This feature is currently not available. However, there is a feature request to "Move replica into Recovery state when replication lag exceeds configuration value" https://jira.mongodb.org/browse/SERVER-4935 This is currently scheduled for "2.1 desired", but this is subject to change. Please vote for it!

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