replSetGetConfig
On this page
Definition
replSetGetConfig
Returns a document that describes the current configuration of the replica set.
Tip
In the
mongo
Shell, this command can also be run through thers.conf()
helper method.Helper methods are convenient for
mongo
users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
Syntax
To run, replSetGetConfig
must be issued against the
admin
database and has the following syntax:
db.adminCommand( { replSetGetConfig: 1, commitmentStatus: <boolean>, comment: <any> } );
Field | Type | Description |
---|---|---|
replSetGetConfig | any | Any value |
boolean | Optional. Specify You can only specify New in version 4.4. | |
comment | any | Optional. A user-provided comment to attach to this command. Once set, this comment appears alongside records of this command in the following locations:
A comment can be any valid BSON type (string, integer, object, array, etc). New in version 4.4. |
The mongo
shell provides the rs.conf()
method
that wraps the replSetGetConfig
command:
rs.conf();
Output Example
The following is an example output of the replSetGetConfig
command run with commitmentStatus: true on the primary:
{ "config" : { "_id" : "myRepl", "version" : 180294, "term" : 1, "protocolVersion" : NumberLong(1), "writeConcernMajorityJournalDefault" : true, "members" : [ { "_id" : 0, "host" : "m1.example.net:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 1, "host" : "m2.example.net:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 2, "host" : "m3.example.net:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 } ], "settings" : { "chainingAllowed" : true, "heartbeatIntervalMillis" : 2000, "heartbeatTimeoutSecs" : 10, "electionTimeoutMillis" : 10000, "catchUpTimeoutMillis" : -1, "catchUpTakeoverDelayMillis" : 30000, "getLastErrorModes" : { }, "getLastErrorDefaults" : { "w" : 1, "wtimeout" : 0 }, "replicaSetId" : ObjectId("5eaa1e9ac4d650aa7817623d") } }, "commitmentStatus" : true, // Available in MongoDB 4.4 "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1588212091, 1), "signature" : { "hash" : BinData(0,"veOHa2mOeRTzuR0LKqnzGxWV77k="), "keyId" : NumberLong("6821298283919441923") } }, "operationTime" : Timestamp(1588212091, 1) }
Field | Description |
---|---|
config | The replica set configuration. For description of each
configuration settings, see
Replica Set Configuration. |
A boolean that indicates whether the most recent replica set configuration has been committed; i.e.
If If | |
ok | A number that indicates whether the command has succeeded ( 1 ) or
failed (0 ). |
operationTime $clusterTime | Returned with every command for a replica set. See
db.adminCommand Response for
details. |