7

I'm using replicaset with 2 nodes(primary and secondary) and 1 arbiter(total 3). Sometimes I get "ERROR while connecting to database. Error: Error: No valid replicaset instance servers found" .I'm not able to reproduce(as it happens on its own and sometimes very frequently).I've added server.on('error',) event to debug but sometimes in my local environment it prints something like connection error printing 1 of the member host name(though I don't know whether it is related to my problem). When I connect to one of the instance through mongo shell and check rs.status() I get everything fine,with all members healthy and up.

Jira link for above question is:

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

Shobhit Mishra
  • 337
  • 1
  • 2
  • 13

1 Answers1

0

An arbiter is like higher authority that votes between secondary nodes to become primary, when the actual primary is down. Add arbiter to odd number of nodes. Bcoz with 2 nodes , when one is down then the other is solely a primary bcoz there is no competition to it.Try adding few more nodes.

TharunRaja
  • 707
  • 7
  • 28