How do you handle a temporary outage of a member of the replica set in mongodb

36 views Asked by At

When one of the servers in the replica set is taken down or goes down, the application times out trying to connect to the replica set.

don't know what to do differently. Is there a programming pattern for handling this? Running Mongodb 3.4.24 on Windows servers.

1

There are 1 answers

0
Wernfried Domscheit On

Try to add readPreference=primaryPreferred to the connection string.

In case when the primary is not available, then the driver should re-connect automatically.