Problem in Lab - Read Concern and Read Preferences

Hello
In the final lab, i must check this

I will simulate a node failure. This is similar to the previous lab, but this time you will shut down two nodes. <But don’t say if is both secondaries or the primary and a secondary

When two of your nodes are unresponsive, you will not be able to connect to the replica set. You will have to connect to the third node, which should be the only healthy node in the cluster.

Which of these readPreferences will allow you to read data from this node?

SecondaryPreferred routes read operations to the secondary members. But if no secondary members are available, the operation then routes to the primary.

Primary read preference routes all read operations to the primary only.

Secondary routes read operations only to the secondary members in the replica set.

nearest outes read operations to the replica set member with the least network latency to the host

primaryPrefered routes read operations to the primary. But if the primary is unavailable, such as during an election or fail-over event, the application can route reads to an available secondary member instead.

I fail 2 times cause i don’t know if i must fail primary and a secondary or both secondaries.
If i kill 2 secondaries… primary is ok… but is not the answer…

Please help!

Hey @ezerod77

It does not matter which 2 nodes you shut down. Once 2 out of 3 nodes become unresponsive you will not be able to connect to the replica set. However as the lab states you will still have access to the third node by connecting directly to it.

You should read over the Read Preferences in the docs to help you out.

And see here for the difference between connecting to a replica set and a standalone node.

Hope this helps.

1 Like

Hi @ezerod77,

Please check the message in the discussion forum.
In addition to @natac13’s reply, I have mentioned few other points in the message to better explain the scenario.

Please let me know, if you have any questions.

Thanks,
Sonali

1 Like

Which message do you refers?

Hi @daniel_71573,

Since in this thread we do not want to explain the answers. So, I had messaged the user personally in discourse to make him understand the concept.

If you have any questions/doubt, please feel free to create a topic in discourse.

Thanks,
Sonali

Hi natac13, I shutdown the two secondary nodes with rs.remove(“192.168.103.100:27002”) and
rs.remove(“192.168.103.100:27003”) and the replica set is runing with the primary. I tried to shut down the primary but i Could not, this is the msg.
MongoDB Enterprise m103-repl:PRIMARY> rs.remove(“192.168.103.100:27001”)
{
“ok” : 0,
“errmsg” : “No host described in new configuration 11 for replica set m103-repl maps to this node”,
“code” : 103,
“codeName” : “NewReplicaSetConfigurationIncompatible”,
“operationTime” : Timestamp(1577551335, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1577551335, 1),
“signature” : {
“hash” : BinData(0,“0EGnF/F6xoSkFMUY6Oqt3i3qefw=”),
“keyId” : NumberLong(“6774884676885544962”)
}
}
}
MongoDB Enterprise m103-repl:PRIMARY>

So I can´t simulate de scenario of the lab.
Could you help me?
Thanks in advanced

Hi @Fernando_Elizaga_32387,

Not responding here because you are already getting the support on this thread.

Thanks,
Shubham Ranjan
Curriculum Support Engineer