On this page本页内容
replSetSyncFrom Temporarily overrides the default sync target for the current 临时覆盖当前mongod. mongod的默认同步目标。This operation is useful for testing different patterns and in situations where a set member is not replicating from the desired host.此操作对于测试不同的模式以及集合成员未从所需主机复制的情况非常有用。
Changed in version 3.2.在版本3.2中更改。
1 vote cannot sync from members with 0 votes.1 vote成员无法与0 votes成员同步。
Run 在replSetSyncFrom in the admin database.admin数据库中运行replSetSyncFrom。
The replSetSyncFrom command has the following form:replSetSyncFrom命令的格式如下:
db.adminCommand( { replSetSyncFrom: "hostname<:port>" })
The replSetSyncFrom command has the following field:replSetSyncFrom命令具有以下字段:
replSetSyncFrom | string |
|
Changed in version 3.4.在版本3.4中更改。
If an initial sync operation is in progress when you run 如果在运行replSetSyncFrom, replSetSyncFrom stops the in-progress initial sync and restarts the sync process with the new target. replSetSyncFrom时正在进行初始同步操作,则replSetSyncFrom将停止正在进行的初始同步,并重新启动与新目标的同步过程。In previous versions, if you run 在以前的版本中,如果在初始同步期间运行replSetSyncFrom during initial sync, MongoDB produces no error messages, but the sync target will not change until after the initial sync operation.replSetSyncFrom,MongoDB不会生成错误消息,但同步目标在初始同步操作之后才会更改。
Only modify the default sync logic as needed, and always exercise caution.仅根据需要修改默认同步逻辑,并始终保持谨慎。
The member to sync from must be a valid source for data in the set. 要从中同步的成员必须是集合中数据的有效源。To sync from a member, the member must:要从成员同步,成员必须:
members[n].buildIndexes setting.members[n].buildIndexes设置生成索引。If you attempt to replicate from a member that is more than 10 seconds behind the current member, 如果您尝试从比当前成员晚10秒以上的成员复制,mongod will log a warning but will still replicate from the lagging member. mongod将记录警告,但仍将从滞后成员复制。See also Replication Lag and Flow Control.另请参阅复制滞后和流量控制。
replSetSyncFrom provide a temporary override of default behavior. 提供默认行为的临时覆盖。mongod will revert to the default sync behavior in the following situations:将在以下情况下恢复为默认同步行为:
For more information the use of 有关使用replSetSyncFrom, see Configure a Secondary's Sync Target.replSetSyncFrom的更多信息,请参阅配置辅助同步目标。