Replication Methods复制方法

Note注意

For details on specific methods, including syntax and examples, click on the specific method to go to its 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.设置此复制集成员将从中同步的成员,覆盖默认同步目标选择逻辑。
←  db.updateRole()rs.add() →