Skip to content

Commit f75d68b

Browse files
npentreljeff-allen-mongo
authored andcommitted
DOCS-14598: Add manual process for psa rs changes
1 parent 5e03dcc commit f75d68b

File tree

4 files changed

+148
-6
lines changed

4 files changed

+148
-6
lines changed

source/administration/replica-set-maintenance.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ replica sets.
4949
:doc:`/tutorial/configure-replica-set-secondary-sync-target`
5050
Specify the member that a secondary member synchronizes from.
5151

52-
:doc:`/tutorial/rename-unsharded-replica-set`
53-
Rename an unsharded replica set.
52+
:doc:`/tutorial/rename-unsharded-replica-set`
53+
Rename an unsharded replica set.
5454

55+
:doc:`/tutorial/modify-psa-replica-set-safely`
56+
Safely perform some reconfiguration changes on a
57+
primary-secondary-arbiter (PSA) replica set or on a replica set that
58+
is changing to a PSA architecture.
5559

5660
.. toctree::
57-
:titlesonly:
58-
:hidden:
61+
:titlesonly:
62+
:hidden:
5963

6064
/tutorial/change-oplog-size
6165
/tutorial/perform-maintence-on-replica-set-members
@@ -67,3 +71,4 @@ replica sets.
6771
/tutorial/change-hostnames-in-a-replica-set
6872
/tutorial/configure-replica-set-secondary-sync-target
6973
/tutorial/rename-unsharded-replica-set
74+
/tutorial/modify-psa-replica-set-safely
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
title: Add or modify a secondary with votes 1 but priority 0
2+
stepnum: 1
3+
ref: modify-psa-replica-set-add-or-modify
4+
pre: |
5+
To avoid rolling back uncommitted writes when adding or changing a
6+
voting, data-bearing node, it is required that you add the node with
7+
``{ priority: 0 }`` first.
8+
9+
In :mongosh:`mongosh </>`, modify the replica set configuration. To
10+
reconfigure an existing replica set, first retrieve the current
11+
configuration with :method:`rs.conf()`, modify the configuration
12+
document as needed, and then pass the modified document to
13+
:method:`rs.reconfig()`:
14+
action:
15+
language: javascript
16+
code: |
17+
cfg = rs.conf();
18+
cfg["members"] = [
19+
{
20+
// existing member or members
21+
},
22+
{
23+
"_id" : <num>, // The array position of the new member in the
24+
// ``members`` array.
25+
"host" : <host>,
26+
"arbiterOnly" : false,
27+
"buildIndexes" : true,
28+
"hidden" : false,
29+
"priority" : 0,
30+
"tags" : { <tags> },
31+
"secondaryDelaySecs" : <num>,
32+
"votes" : 1
33+
},
34+
{
35+
// existing member or members
36+
}
37+
]
38+
rs.reconfig(cfg);
39+
---
40+
title: Reconfigure the secondary to have non-zero priority
41+
stepnum: 2
42+
ref: modify-psa-replica-set-reconfigure
43+
pre: |
44+
Once the secondary is caught up, set the prority to the desired
45+
number. Before this reconfiguration succeeds, the secondary must
46+
replicate all the writes that were committed when it had zero votes.
47+
This is automatically checked when you issue the
48+
:method:`rs.reconfig()` command.
49+
50+
action:
51+
language: javascript
52+
code: |
53+
cfg = rs.conf();
54+
cfg["members"] = [
55+
{
56+
// existing member or members
57+
},
58+
{
59+
"_id" : <num>, // The array position of the new member in the
60+
// ``members`` array.
61+
"host" : <host>,
62+
"arbiterOnly" : false,
63+
"buildIndexes" : true,
64+
"hidden" : false,
65+
"priority" : <num>,
66+
"tags" : { <tags> },
67+
"secondaryDelaySecs" : <num>,
68+
"votes" : 1
69+
},
70+
{
71+
// existing member or members
72+
}
73+
]
74+
rs.reconfig(cfg);
75+
...

source/release-notes/5.0.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ Reconfiguring PSA Replica Sets
236236
When reconfiguring primary-secondary-arbiter (PSA) replica sets or
237237
changing to a PSA architecture, it is now in some cases required to
238238
perform the reconfiguration in a two-step change. MongoDB 5.0 introduces
239-
the :method:`rs.reconfigForPSASet()` method which performs both steps
240-
together.
239+
the :method:`rs.reconfigForPSASet()` method which performs both steps.
240+
If you cannot use the helper method, follow the procedure in
241+
:ref:`modify-psa-replica-set-safely`.
241242

242243
.. _5.0-rel-notes-security:
243244

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. _modify-psa-replica-set-safely:
2+
3+
=============================
4+
Modify PSA Replica Set Safely
5+
=============================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Overview
16+
--------
17+
18+
When reconfiguring primary-secondary-arbiter (PSA) replica sets or
19+
changing to a PSA architecture, you need to take special care in the
20+
following cases:
21+
22+
- You want to reconfigure a secondary in an existing three-member
23+
replica set with a PSA architecture to become a voting, data-bearing
24+
node with a non-zero priority.
25+
- You want to add a new voting, data-bearing node with a non-zero
26+
priority to an existing two-member replica set that contains one
27+
primary and one arbiter.
28+
29+
.. warning::
30+
31+
If the secondary you are adding is lagged and the resulting replica
32+
set is a PSA configuration, the first configuration change will
33+
change the number of nodes that need to commit a change with
34+
:writeconcern:`"majority"`. In this case, your commit point will lag
35+
until the secondary has caught up.
36+
37+
This document outlines the procedure for reconfiguring your replica set
38+
in these specific cases **without** using the designated helper method
39+
:method:`rs.reconfigForPSASet`.
40+
41+
Procedure
42+
---------
43+
44+
If you are performing one of the preceding operations, it is necessary
45+
to reconfigure your replica set in two steps:
46+
47+
1. Reconfigure the replica set to add or modify a secondary with
48+
``{ votes: 1, priority: 0 }``.
49+
2. Once the added or modified secondary has caught up with all
50+
committed writes, reconfigure the secondary to have a non-zero
51+
priority ``{ votes: 1, priority: <num> }``.
52+
53+
The two-step approach avoids the possibility of rolling back
54+
committed writes in the case of a failover to the new secondary
55+
before the new secondary has all committed writes from the previous
56+
primary.
57+
58+
To run the :method:`rs.reconfigForPSASet()` method, you must connect
59+
to the :term:`primary` of the replica set.
60+
61+
.. include:: /includes/steps/modify-psa-replica-set-safely.rst

0 commit comments

Comments
 (0)