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