@@ -15,30 +15,193 @@ Definition
15
15
16
16
.. dbcommand:: replSetGetConfig
17
17
18
- Returns a document that describes the current configuration of the
19
- :term:`replica set`. To invoke the command directly, use the
20
- following operation:
18
+ Returns a document that describes the current :ref:`configuration
19
+ <replica-set-configuration-document>` of the :term:`replica set`.
21
20
22
- .. code-block:: javascript
21
+ Syntax
22
+ ------
23
23
24
- db.runCommand( { replSetGetConfig: 1 } );
24
+ To run, :dbcommand:`replSetGetConfig` must be issued against the
25
+ ``admin`` database and has the following syntax:
25
26
26
- In the :binary:`~bin.mongo` shell, you can access the data provided by
27
- :dbcommand:`replSetGetConfig` using the :method:`rs.conf()` method,
28
- as in the following:
27
+ .. code-block:: javascript
29
28
30
- .. code-block:: javascript
29
+ db.adminCommand( {
30
+ replSetGetConfig: 1,
31
+ commitmentStatus: <boolean> // Available starting in MongoDB 4.4
32
+ } );
31
33
32
- rs.conf();
34
+ .. list-table::
35
+ :header-rows: 1
36
+ :widths: 20 15 65
37
+
38
+ * - Field
39
+ - Type
40
+ - Description
41
+
42
+ * - ``replSetGetConfig``
43
+ - any
44
+ - Any value
45
+
46
+ * - :ref:`commitmentStatus <replSetGetConfig-commitmentStatus>`
47
+
48
+ - boolean
49
+
50
+ - .. _replSetGetConfig-commitmentStatus:
51
+
52
+ Optional. Specify ``true`` to include a :ref:`commitmentStatus
53
+ <replSetGetConfig-output-commitmentStatus>` field in the output.
54
+ The :ref:`commitmentStatus
55
+ <replSetGetConfig-output-commitmentStatus>` output field
56
+ indicates whether the replica set's previous reconfig has been
57
+ committed, so that the replica set is ready to be reconfigured
58
+ again. For details, see :ref:`commitmentStatus Output Field
59
+ <replSetGetConfig-output-commitmentStatus>`.
60
+
61
+ You can only specify ``commitmentStatus: true`` option when
62
+ running the command on the primary. The command errors if run
63
+ with ``commitmentStatus: true`` on a secondary.
64
+
65
+ .. versionadded:: 4.4
66
+
67
+ The :binary:`~bin.mongo` shell provides the :method:`rs.conf()` method
68
+ that wraps the :dbcommand:`replSetGetConfig` command:
69
+
70
+ .. code-block:: javascript
71
+
72
+ rs.conf();
33
73
34
74
.. _replSetGetConfig-example:
35
75
36
76
Output Example
37
77
--------------
38
78
39
- .. include:: /includes/replica-set-conf-document-output.rst
79
+ The following is an example output of the :dbcommand:`replSetGetConfig`
80
+ command run with :ref:`commitmentStatus: true
81
+ <replSetGetConfig-commitmentStatus>` on the primary:
82
+
83
+ .. code-block:: javascript
84
+
85
+ {
86
+ "config" : {
87
+ "_id" : "myRepl",
88
+ "version" : 180294,
89
+ "term" : 1,
90
+ "protocolVersion" : NumberLong(1),
91
+ "writeConcernMajorityJournalDefault" : true,
92
+ "members" : [
93
+ {
94
+ "_id" : 0,
95
+ "host" : "m1.example.net:27017",
96
+ "arbiterOnly" : false,
97
+ "buildIndexes" : true,
98
+ "hidden" : false,
99
+ "priority" : 1,
100
+ "tags" : {
101
+
102
+ },
103
+ "slaveDelay" : NumberLong(0),
104
+ "votes" : 1
105
+ },
106
+ {
107
+ "_id" : 1,
108
+ "host" : "m2.example.net:27017",
109
+ "arbiterOnly" : false,
110
+ "buildIndexes" : true,
111
+ "hidden" : false,
112
+ "priority" : 1,
113
+ "tags" : {
114
+
115
+ },
116
+ "slaveDelay" : NumberLong(0),
117
+ "votes" : 1
118
+ },
119
+ {
120
+ "_id" : 2,
121
+ "host" : "m3.example.net:27017",
122
+ "arbiterOnly" : false,
123
+ "buildIndexes" : true,
124
+ "hidden" : false,
125
+ "priority" : 1,
126
+ "tags" : {
127
+
128
+ },
129
+ "slaveDelay" : NumberLong(0),
130
+ "votes" : 1
131
+ }
132
+ ],
133
+ "settings" : {
134
+ "chainingAllowed" : true,
135
+ "heartbeatIntervalMillis" : 2000,
136
+ "heartbeatTimeoutSecs" : 10,
137
+ "electionTimeoutMillis" : 10000,
138
+ "catchUpTimeoutMillis" : -1,
139
+ "catchUpTakeoverDelayMillis" : 30000,
140
+ "getLastErrorModes" : {
141
+
142
+ },
143
+ "getLastErrorDefaults" : {
144
+ "w" : 1,
145
+ "wtimeout" : 0
146
+ },
147
+ "replicaSetId" : ObjectId("5eaa1e9ac4d650aa7817623d")
148
+ }
149
+ },
150
+ "commitmentStatus" : true, // Available in MongoDB 4.4
151
+ "ok" : 1,
152
+ "$clusterTime" : {
153
+ "clusterTime" : Timestamp(1588212091, 1),
154
+ "signature" : {
155
+ "hash" : BinData(0,"veOHa2mOeRTzuR0LKqnzGxWV77k="),
156
+ "keyId" : NumberLong("6821298283919441923")
157
+ }
158
+ },
159
+ "operationTime" : Timestamp(1588212091, 1)
160
+ }
161
+
162
+ .. list-table::
163
+ :widths: 20 80
164
+
165
+ * - ``config``
166
+
167
+ - The replica set configuration. For description of each
168
+ configuration settings, see
169
+ :doc:`/reference/replica-configuration`.
170
+
171
+ * - :ref:`commitmentStatus <replSetGetConfig-output-commitmentStatus>`
172
+
173
+ - .. _replSetGetConfig-output-commitmentStatus:
174
+
175
+ A boolean that indicates whether the most recent replica set
176
+ configuration has been committed; i.e.
177
+
178
+ - The most recent replica set configuration for the primary has
179
+ propagated to a majority of members, and
180
+
181
+ - The last write operation to the replica set with the previous
182
+ configuration has been :data:`majority-commited
183
+ <replSetGetStatus.writeMajorityCount>` in the new
184
+ configuration.
185
+
186
+ If ``true``, then the configuration has been committed, and the
187
+ replica set can be reconfigured. To reconfigure the replica set,
188
+ see :dbcommand:`replSetReconfig` command or the
189
+ :binary:`~bin.mongo` shell method :method:`rs.reconfig()`.
190
+
191
+ If ``false``, then the configuration has not been committed, and
192
+ the replica set cannot be reconfigured.
193
+
194
+ * - ``ok``
195
+
196
+ - A number that indicates whether the command has succeeded (``1``) or
197
+ failed (``0``).
198
+
199
+ * - | ``operationTime``
200
+ | ``$clusterTime``
201
+
202
+ - Returned with every command for a replica set. See
203
+ :ref:`db.adminCommand Response <db-adminCommand-response>` for
204
+ details.
40
205
41
- For description of the configuration settings, see
42
- :doc:`/reference/replica-configuration`.
43
206
44
207
.. seealso:: :method:`rs.conf()`, :method:`rs.reconfig()`
0 commit comments