On this page本页内容
replSetSyncFrom
¶Temporarily overrides the default sync target for the current 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中更改。MongoDB 3.2 replica set members with 1 vote
cannot sync from members with 0 votes
.
Run replSetSyncFrom
in the admin
database.
The replSetSyncFrom
command has the following form:
The replSetSyncFrom
command has the following field:
replSetSyncFrom |
string | The name and port number of the replica set member that this member should replicate from. Use the |
Changed in version 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. 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.
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.If you attempt to replicate from a member that is more than 10 seconds behind the current member, mongod
will log a warning but will still replicate from the lagging member. 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:
mongod
instance restarts.mongod
and the sync target closes.For more information the use of replSetSyncFrom
, see Configure a Secondary’s Sync Target.