rs.conf()
On this page本页内容
Definition定义
rs.conf()
-
Returns a document that contains the current replica set configuration.返回包含当前副本集配置的文档。Importantmongosh Method
This page documents a
mongosh
method. This is not the documentation for database commands or language-specific drivers, such as Node.js.For the database command, see the
replSetGetConfig
command.For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.
For the legacy
mongo
shell documentation, refer to the documentation for the corresponding MongoDB Server release:ThereplSetGetConfig
command can specify a new option commitmentStatus: true when run on the primary.replSetGetConfig
命令可以在主服务器上运行时指定一个新选项commitmentStatus: true
。When 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()
的别名