Skip to content

Commit db25197

Browse files
author
Sam Kleinman
committed
minor edits: replica set read preference article
1 parent 8039935 commit db25197

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

source/applications/replication.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ for a replica set. Use the :data:`settings.getLastErrorDefaults` setting
6767
in the :doc:`replica set configuration
6868
</reference/replica-configuration>`. The following sequence of commands
6969
creates a configuration that waits for the write operation to complete
70-
on a majority of the set members before returning:
70+
on a majority of the set members beforBe returning:
7171

7272
.. code-block:: javascript
7373

@@ -172,8 +172,7 @@ read preference modes:
172172

173173
You can specify a read preference mode on connection objects, database object,
174174
collection object, or per-operation. The syntax for specifying the read
175-
preference mode is :api:`specific to the driver and to the idioms of the host
176-
language <>`.
175+
preference mode is :api:`specific to the driver and to the idioms of the host language <>`.
177176

178177
Read preference modes are also available to clients connecting to a
179178
:term:`sharded cluster` through a :program:`mongos`. The
@@ -525,8 +524,8 @@ for more information.
525524

526525
.. [#acceptable-secondary-latency] Applications can configure the
527526
threshold used in this stage. The default "acceptable latency" is
528-
15 milliseconds, which you can override in the drivers with the
529-
`secondaryAcceptableLatencyMS` option.
527+
15 milliseconds, which you can override in the drivers with their own
528+
``secondaryAcceptableLatencyMS`` option.
530529
For :program:`mongos` you can use the
531530
:option:`--localThreshold <mongos --localThreshold>` or
532531
:setting:`localThreshold` runtime options to set this value.
@@ -614,22 +613,11 @@ using non-:readmode:`primary` read preference modes:
614613
- Reporting and analytics workloads.
615614

616615
Having these queries target a :term:`secondary` helps distribute
617-
load and prevent these operations from affecting the primary
618-
workload of the primary.
616+
load and prevent these operations from affecting the main workload
617+
of the primary.
619618

620619
Also consider using :readmode:`secondary` in conjunction with a
621-
direct connection to a :ref:`hidden member
622-
<replica-set-hidden-members>` of the set.
623-
624-
.. warning::
625-
626-
Although it is tempting to use :readmode:`secondaryPreferred` to distribute
627-
load, if your primary cannot accept your full read load, then
628-
using :readmode:`secondaryPreferred` is dangerous: if all secondaries
629-
become unavailable, but you have enough arbiters to prevent the primary from
630-
stepping down, then this mode will redirect traffic to the primary. For this
631-
reason, use :readmode:`secondary` to distribute load,
632-
not :readmode:`secondaryPreferred`.
620+
direct connection to a :ref:`hidden member <replica-set-hidden-members>` of the set.
633621

634622
- Providing local reads for geographically distributed applications.
635623

@@ -642,9 +630,21 @@ using non-:readmode:`primary` read preference modes:
642630
- Maintaining availability during a failover.
643631

644632
Use :readmode:`primaryPreferred` if you want your application to do
645-
consistent reads from the primary under normal circumstances, but to allow
646-
stale reads from secondaries in an emergency. This provides a "read-only mode"
647-
for your application during a failover.
633+
consistent reads from the primary under normal circumstances, but to
634+
allow stale reads from secondaries in an emergency. This provides a
635+
"read-only mode" for your application during a failover.
636+
637+
.. warning::
638+
639+
In some situations using :readmode:`secondaryPreferred` to
640+
distribute read load to replica sets may carry significant
641+
operational risk: if all secondaries are unavailable and your set
642+
has enough :term:`arbiters <arbiter>` to prevent the primary from
643+
stepping down, then the primary will receive all traffic from
644+
clients.
645+
646+
For this reason, use :readmode:`secondary` to distribute read load
647+
to replica sets, not :readmode:`secondaryPreferred`.
648648

649649
Using read modes other than :readmode:`primary` and
650650
:readmode:`primaryPreferred` to provide extra capacity is not in and

0 commit comments

Comments
 (0)