"ERROR connecting to database Error: Error: no valid replicaset instance servers found"

I use a replicaset with two nodes (primary and secondary) and 1 arbiter (total 3). Sometimes I get the message "ERROR when connecting to the database. Error: Error: No valid replicaset instance servers were found." I can not reproduce (how this happens on its own, and sometimes very often). I added server.on ('error',) for debugging, but sometimes in my local environment it prints something like printing connection error 1 member node name (although I don't know if this is due to my problem). When I connect to one of the instances via the mongo shell and check rs.status (), I get everything in order, all members are healthy and above.

Link to Jira for the above question:

https://jira.mongodb.org/browse/NODE-296

+7
mongodb database-replication
source share
1 answer

The arbiter is like a higher authority who votes between secondary nodes to become primary when the actual primary object is omitted. Add an arbiter to an odd number of nodes. Bcoz with two nodes, when one is down and the other is only the primary bcoz, there is no competition for it. Add some nodes.

0
source share

All Articles