This version of the documentation is archived and no longer supported.

Configure a Secondary’s Sync Target

To override the default sync target selection logic, you may manually configure a secondary member’s sync target for pulling oplog entries temporarily. The following operations provide access to this functionality:

Only modify the default sync logic as needed, and always exercise caution. rs.syncFrom() will not affect an in-progress initial sync operation. To affect the sync target for the initial sync, run rs.syncFrom() operation before initial sync.

If you run rs.syncFrom() during initial sync, MongoDB produces no error messages, but the sync target will not change until after the initial sync operation.


replSetSyncFrom and rs.syncFrom() provide a temporary override of default behavior. mongod will revert to the default sync behavior in the following situations:

  • The mongod instance restarts.
  • The connection between the mongod and the sync target closes.

Changed in version 2.4: The sync target falls more than 30 seconds behind another member of the replica set; the mongod will revert to the default sync target.