Read Preferences - secondaryPreferred

Hi,

As per docs: " In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary on sharded clusters."

Is there a scenario when there are no secondary nodes available, but primary is?

I thought that if, lets say in replica set of 3, both secondary nodes die, then primary one becomes secondary as it cannot serve write operation (I assume reads are still permitted). So… there are no primaries available.

Can you please give me an example of situation then secondary nodes are not available and primary still is (in reference to secondaryPreferred read pref).

Cheers,
Michal

Hi Michal,

In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary on sharded clusters.

where is this paragraph from? The link to the secondary nodes reads “…may handle read operations”.

As per default, clients write to and read from the primary node in a replica set. It can be configured to read from secondary nodes though.

If there is a set of 3 nodes and one is an Arbiter, and the secondary goes down, then it seems the only choice is to read from the primary. An arbiter is not a secondary node, since it can not be chosen primary.

Not completely sure this is what you ask for.

Hi @Michal_Szkudlarek,

Can you share the link to the documentation that you are referring to ?

It is from:

@Santiato_Miranda
I think that Arbiter example is a scenario I was looking for

Oh, I see, I missed the title when answering somehow.


Glad to hear :slight_smile: and interesting article.