replSetGetConfig

3.0.0 版中的新功能。

在本页面

Definition

  • replSetGetConfig
    • 返回描述replica set当前配置的文档。要直接调用命令,请使用以下操作:
db.runCommand( { replSetGetConfig: 1 } );

mongo shell 中,您可以使用rs.conf()方法访问replSetGetConfig提供的数据,如下所示:

rs.conf();

Output Example

以下文档提供了副本集配置文档的表示。您的副本集的配置可能仅包括这些设置的一部分:

{
  _id: <string>,
  version: <int>,
  protocolVersion: <number>,
  writeConcernMajorityJournalDefault: <boolean>,
  configsvr: <boolean>,
  members: [
    {
      _id: <int>,
      host: <string>,
      arbiterOnly: <boolean>,
      buildIndexes: <boolean>,
      hidden: <boolean>,
      priority: <number>,
      tags: <document>,
      slaveDelay: <int>,
      votes: <number>
    },
    ...
  ],
  settings: {
    chainingAllowed : <boolean>,
    heartbeatIntervalMillis : <int>,
    heartbeatTimeoutSecs: <int>,
    electionTimeoutMillis : <int>,
    catchUpTimeoutMillis : <int>,
    getLastErrorModes : <document>,
    getLastErrorDefaults : <document>,
    replicaSetId: <ObjectId>
  }
}

有关配置设置的说明,请参见副本集配置