发布于 2015-09-14 15:04:21 | 226 次阅读 | 评论: 0 | 来源: 网络整理

replSetSyncFrom

2.2 新版功能.

Options:
  • host – Specifies the name and port number of the replica set member that this member replicates from. Use the [hostname]:[port] form.

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:

  • itself.
  • an arbiter, because arbiters do not hold data.
  • a member that does not build indexes.
  • an unreachable member.
  • a mongod instance that is not a member of the same replica set.

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.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务