I have a general question in regards to a 3 node replica set (no arbiters), and what happens is 2 of the 3 nodes go down. My understanding is that the last node will automatically become a secondary, read only member. Would we still be able to connect to the remaining node?
Yes but it becomes secondary.
Thanks. I was aware that it becomes a secondary. Was that yes, confirming that it’s not accessible?
You can connect to it. But you cannot write.
Hi. I’ll have to try that in a local VM, as I’m not convinced that actually happens. Last time I tried it said slaveOk=false, even if I set it in the url/connection string. Thanks
It doesn’t automatically become readable, you have to instruct it with either
rs.slaveOk() or an appropriate readPreference. Have a look at this discussion (and the discussion within).
I have tried that, but it has not worked for me in the past, with slaveOk=true, I’ve also tried setting the readPreference to secondary as well. I will re-try/test at some point, and update with my findings. If there’s no primary in the replica set, I’m certain you cannot connect to the remaining secondary member. A replica set is pretty much useless without at least one primary. Interesting if anyone has actually tested the same scenario.
Did you manage to read the discussions in the link I posted? In the embedded discussion link I stated,
“Only direct connections to a secondary node, i.e. connection strings without the name of the replica set and host+port pointing to that available node, will succeed.”