If the chainingAllowed setting
allows secondary members to sync from other secondaries, MongoDB by
default prefers non-hidden members over hidden members when selecting
a sync target. MongoDB will only choose hidden members as a last
resort. If you want a secondary to sync from a hidden member, use the
replSetSyncFrom database command to override the default
sync target. See the documentation for replSetSyncFrom
before using the command.
The following example hides the secondary member currently at the index
0 in the members array. To configure
a hidden member, use the following sequence of operations in a
mongo shell connected to the primary, specifying the member
to configure by its array index in the
After re-configuring the set, this secondary member has a priority of
0 so that it cannot become primary and is hidden. The other members
in the set will not advertise the hidden member in the
isMaster or db.isMaster() output.
When updating the replica configuration object, access the replica set
members in the members array with the
array index. The array index begins with 0. Do not confuse
this index value with the value of the
_id field in each document in
the members array.
The rs.reconfig() shell method can force the current
primary to step down, which causes an election. When the primary steps down, the
mongod closes all client connections. While this
typically takes 10-20 seconds, try to make these changes during
scheduled maintenance periods.
To successfully reconfigure a replica set, a majority of the
members must be accessible. If your replica set has an even number
of members, add an arbiter to ensure that members can
quickly obtain a majority of votes in an election for primary.