rs.conf()

On this page本页内容

Definition定义

rs.conf()

Returns a document that contains the current replica set configuration.返回包含当前副本集配置的文档。

The method wraps the replSetGetConfig command.该方法包装replSetGetConfig命令。

The replSetGetConfig command can specify a new option commitmentStatus: true when run on the primary. replSetGetConfig命令可以在主服务器上运行时指定新选项commitmentStatus:trueWhen run with the option, the command includes in the output a commitmentStatus field. 使用选项运行时,该命令在输出中包含commitmentStatus字段。This output field indicates whether the replica set's previous reconfig has been committed, so that the replica set is ready to be reconfigured again. 此输出字段指示副本集的先前重新配置是否已提交,以便副本集可以再次重新配置。The option is only available with the replSetGetConfig command.该选项仅适用于replSetGetConfig命令。

Output Example输出示例

The following document provides a representation of a replica set configuration document. 以下文档提供了副本集配置文档的表示。The configuration of your replica set may include only a subset of these settings:副本集的配置可能仅包括以下设置的子集:

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

For description of the configuration settings, see Replica Set Configuration.有关配置设置的说明,请参阅副本集配置

rs.config()

rs.config() is an alias of rs.conf().rs.conf()的别名。

←  rs.addArb()rs.freeze() →