0

I have a replica set with 3 nodes X, Y & A (where A is an arbiter). Currently X is assigned a higher priority than Y. When X goes down, Y becomes the PRIMARY. When X is back in action, the data sync happens, Y continues to be the PRIMARY and X acts as SECONDARY.

My requirement is as follows:

When X is back in action, I want X to automatically become the PRIMARY (i.e. without any manual intervention), once the X has synced all the data from Y.

I understand that I shouldn't be really worried about which node is primary and which one is secondary, but in my case the performance of Y node is really bad (due to the network latency) and would like to keep X as PRIMARY as much as possible.

Is there any settings / configuration in MongoDB that I can use to achieve this behavior? The version I'm using currently is 3.4.3

Thanks.

1 Answer 1

1

If you have modified X nodes priority at rs.conf() higher number than Y node, switch over should automatically happen WHEN X has replicated all information from Y node. Not before that. If switch doesn't happen, check rs.printSlaveReplicationInfo() that your X is really 0 second behind. It sounds like that your Y is so slow that even X cannot read opLog fast enough and keeps lagging that why.

1
  • Really? That would be a good news. We are rebuilding our replica set currently. I'll check the printSlaveReplicationInfo and see if your suspicion is correct or not.
    – cdoe
    Sep 8, 2017 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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