I have an unusual problem. I have configured a 3 node replica set using MongoDB Community edition version 3.6.2, with SSL and Basic-Auth. I can connect to the cluster when the PRIMARY node is the node that I ran rs.initiate() on.
Node1 = Initial node where I ran rs.initiate() and added in additional replicas.
Node2 = Secondary
Node3 = Secondary
All nodes in the replica set have a priority of 10 and votes of 1.
If I then stop Node1 when it is the PRIMARY, I can see one of the other nodes switching to be a PRIMARY, currently Node3 on my servers, but I cannot connect to the cluster after that. Even though there is a primary node available.
In fact the only connection I can make is a direct connection to that node that became the PRIMARY. The normal clustered connection string won't work at all. Once I'm connected onto that node I can run an rs.status() and can see both nodes are currently available, Node3 as primary, Node2 as secondary and Node1 is unreachable.
I'm just wondering if anyone has some idea about what could possibly be wrong here.
I'm using the standard connection string format for a cluster
mongodb://user:password@node1:27017,node2:27017,node3:27017/dbName??maxIdleTimeMS=60000&readPreference=primary&ssl=true
replicaSetname which is required to establish a replica set connection. If areplicaSetname is not provided, your client will create a standalone connection to the first member of your seed list. Standalone connections do not support server discovery or failover. - Stennie