@@ -43,6 +43,12 @@ Procedures
43
43
Convert a Secondary to an Arbiter and Reuse the Port Number
44
44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
45
46
+ #. If your application is connecting directly to the secondary,
47
+ modify the application so that MongoDB queries don't reach
48
+ the secondary.
49
+
50
+ #. Shut down the secondary.
51
+
46
52
#. Remove the :term:`secondary` from the :term:`replica set` by calling
47
53
the :method:`rs.remove()` method. Perform this operation while connected to the current
48
54
:term:`primary` in the :program:`mongo` shell:
@@ -58,8 +64,6 @@ Convert a Secondary to an Arbiter and Reuse the Port Number
58
64
59
65
rs.config()
60
66
61
- #. Shut down the secondary.
62
-
63
67
#. Move the secondary's data directory to an archive folder. For example:
64
68
65
69
.. code-block:: sh
@@ -68,9 +72,6 @@ Convert a Secondary to an Arbiter and Reuse the Port Number
68
72
69
73
.. optional:: You may remove the data instead.
70
74
71
- #. Modify your application so that MongoDB queries don't reach
72
- the secondary.
73
-
74
75
#. Create a new, empty data directory to point to when restarting the
75
76
:program:`mongod` instance. You can reuse the previous name. For
76
77
example:
@@ -113,13 +114,19 @@ Convert a Secondary to an Arbiter and Reuse the Port Number
113
114
Convert a Secondary to an Arbiter Running on a New Port Number
114
115
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115
116
116
- #. Create a new, empty data directory. For example:
117
+ #. If your application is connecting directly to the secondary
118
+ or has a connection string referencing the secondary,
119
+ modify the application so that MongoDB queries don't reach
120
+ the secondary.
121
+
122
+ #. Create a new, empty data directory to be used with the new port
123
+ number. For example:
117
124
118
125
.. code-block:: sh
119
126
120
127
mkdir /data/db-temp
121
128
122
- #. Start a new :program:`mongod` instance on a different port,
129
+ #. Start a new :program:`mongod` instance on the new port number ,
123
130
specifying the new data directory and the existing replica
124
131
set. Issue a command similar to the following:
125
132
@@ -128,14 +135,14 @@ Convert a Secondary to an Arbiter Running on a New Port Number
128
135
mongod --port 27021 --dbpath /data/db-temp --replSet rs
129
136
130
137
#. In the :program:`mongo` shell connected to the current primary,
131
- convert the secondary to an arbiter using the :method:`rs.addArb()`
138
+ convert the new :program:`mongod` instance to an arbiter using the :method:`rs.addArb()`
132
139
method:
133
140
134
141
.. code-block:: javascript
135
142
136
143
rs.addArb("<hostname>:<port>")
137
144
138
- #. Verify the arbiter belongs to the replica set by calling the
145
+ #. Verify the arbiter has been added to the replica set by calling the
139
146
:method:`rs.config()` method in the :program:`mongo` shell.
140
147
141
148
.. code-block:: javascript
@@ -150,17 +157,14 @@ Convert a Secondary to an Arbiter Running on a New Port Number
150
157
151
158
#. Shut down the secondary.
152
159
153
- #. If you have an application connection string referencing the old
154
- secondary, remove the reference.
155
-
156
160
#. Remove the :term:`secondary` from the :term:`replica set` by calling
157
161
the :method:`rs.remove()` method in the :program:`mongo` shell:
158
162
159
163
.. code-block:: javascript
160
164
161
165
rs.remove("<hostname>:<port>")
162
166
163
- #. Verify that the replica set no longer includes the secondary by
167
+ #. Verify that the replica set no longer includes the old secondary by
164
168
calling the :method:`rs.config()` method in the :program:`mongo` shell:
165
169
166
170
.. code-block:: javascript
0 commit comments