Docs HomeMongoDB Manual

Replication Methods复制方法

Note

For details on a specific method, including syntax and examples, click on the link to the method's reference page.有关特定方法的详细信息,包括语法和示例,请单击该方法参考页的链接。

Name名称Description描述
rs.add()Adds a member to a replica set.将成员添加到副本集中。
rs.addArb()Adds an arbiter to a replica set.仲裁器添加到副本集中。
rs.conf()Returns the replica set configuration document.返回副本集配置文档。
rs.freeze()Prevents the current member from seeking election as primary for a period of time.阻止当前成员在一段时间内以初选身份寻求选举。
rs.help()Returns basic help text for replica set functions.返回副本集函数的基本帮助文本。
rs.initiate()Initializes a new replica set.初始化新的复制副本集。
rs.printReplicationInfo()Prints a formatted report of the replica set status from the perspective of the primary.从主副本的角度打印副本集状态的格式化报告。
rs.printSecondaryReplicationInfo()Prints a formatted report of the replica set status from the perspective of the secondaries.从辅助设备的角度打印副本集状态的格式化报告。
rs.printSlaveReplicationInfo()Deprecated since version 4.4.1:自4.4.1版起弃用: Use rs.printSecondaryReplicationInfo() instead.请改用rs.printSecondaryReplicationInfo()
rs.reconfig()Reconfigures a replica set by applying a new replica set configuration object.通过应用新的副本集配置对象来重新配置副本集。
rs.reconfigForPSASet()Safely perform some reconfiguration changes on a primary-secondary-arbiter (PSA) replica set or on a replica set that is changing to a PSA architecture.在主辅助仲裁器(PSA)副本集或正在更改为PSA架构的副本集上安全地执行一些重新配置更改。
rs.remove()Remove a member from a replica set.从副本集中删除成员。
rs.status()Returns a document with information about the state of the replica set.返回一个文档,其中包含有关副本集状态的信息。
rs.stepDown()Causes the current primary to become a secondary which forces an election.使当前的primary变为secondary,从而强制进行选举
rs.syncFrom()Sets the member that this replica set member will sync from, overriding the default sync target selection logic.设置此副本集成员将从中同步的成员,覆盖默认的同步目标选择逻辑。