On this page本页内容
replSetGetConfig
Returns a document that describes the current configuration of the replica set.返回描述副本集当前配置的文档。
To run, 要运行,必须针对replSetGetConfig
must be issued against the admin
database and has the following syntax:admin
数据库发出replSetGetConfig
,并具有以下语法:
db.adminCommand( { replSetGetConfig: 1, commitmentStatus: <boolean>, comment: <any> } );
replSetGetConfig | any | |
commitmentStatus | boolean |
|
comment | any |
|
mongosh
provides the 提供了包装rs.conf()
method that wraps the replSetGetConfig
command:replSetGetConfig
命令的rs.conf()
方法:
rs.conf();
The following is an example output of the 以下是在primary上使用replSetGetConfig
command run with commitmentStatus: true on the primary:commitmentStatus: true
运行的replSetGetConfig
命令的示例输出:
{ "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" : { }, "secondaryDelaySecs" : NumberLong(0), "votes" : 1 }, { "_id" : 1, "host" : "m2.example.net:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "secondaryDelaySecs" : NumberLong(0), "votes" : 1 }, { "_id" : 2, "host" : "m3.example.net:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "secondaryDelaySecs" : 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) }
config | |
commitmentStatus |
|
ok | 1 ) or failed (0 ). 1 )或失败(0 )的数字。 |
operationTime $clusterTime | db.adminCommand 响应。 |