How can MongoDB 4.0.12 be configured to SLOW its rate of re-connecting to its replica members when they are down?

I had MongoDB replica members die. The online replica members get “connection refused” when trying down members, then re-attempt to connect as fast as the CPU and network allow. This crushes the CPU and makes the log files grow huge as Mongo retries it’s connection hundreds of time ps per minute.

I'd rather MongoDB retry to reach replica members only once per minute, rather than immediately after getting a failure. There’s no reason to retry a down server hundreds of times per minute.

Is there a way to configure MongoDB to wait for some seconds before attempting a reconnect when a replica member is down? I can't find any such setting in the server & replica settings, and this seems like it would be an important thing to set.


I don't have a specific answer, however, you can consider the following. Once a member is crashed, you can change it to be hidden. Once it is hidden, clients will not try to connect. Once it is up, let it complete the data from the oplog and change it back.

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.