发布于 2015-09-14 15:04:21 | 226 次阅读 | 评论: 0 | 来源: 网络整理
2.2 新版功能.
Options: |
|
---|
replSetSyncFrom allows you to explicitly configure which host the current mongod will poll oplog entries from. This operation may be useful for testing different patterns and in situations where a set member is not replicating from the host you want. The member to replicate from must be a valid source for data in the set.
A member cannot replicate from:
If you attempt to replicate from a member that is more than 10 seconds behind the current member, mongod will return and log a warning, but it still will replicate from the member that is behind.
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.
The command has the following prototype form:
{ replSetSyncFrom: "[hostname]:[port]" }
To run the command in the mongo shell, use the following invocation:
db.adminCommand( { replSetSyncFrom: "[hostname]:[port]" } )
You may also use the rs.syncFrom() helper in the mongo shell, in an operation with the following form:
rs.syncFrom("[hostname]:[port]")
注解
replSetSyncFrom and rs.syncFrom() provide a temporary override of default behavior. If:
the mongod instance restarts,
the connection to the sync target closes, or
在 2.4 版更改: The sync target falls more than 30 seconds behind another member of the replica set;
then, the mongod instant will revert to the default sync logic and target.