0

Example: 3 node on RS with mongos and mongoc(cluster)

On one Secondary node(on RS) we have replica lag, e.g. - 1h.
So, if my read preference is - secondaryPrefered and if I read data from RS, can it happen that I will read data from a node that has a replication lag?
Or does mongodb have some sort of protection mechanisms?

0

Yes, the data you read from SECONDARY might not be up-to-date. The obvious solution if you are no fine with it: read from the PRIMARY.

However, one hour sounds a lot. Did you configure a Delayed Member or did you configure storage.oplogMinRetentionHours?

1
  • "Yes, the data you read from SECONDARY might not be up-to-date. The obvious solution if you are no fine with it: read from the PRIMARY." Thanks, that's all I wanted to hear. – 404notfoundhard May 6 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.