Hidden Replica Set Members

A hidden member maintains a copy of the primary’sdata set but is invisible to client applications. Hidden membersare good for workloads with different usage patterns from the othermembers in the replica set. Hidden members must always bepriority 0 members andso cannot become primary. The db.isMaster() method does notdisplay hidden members. Hidden members, however, may vote inelections.

In the following five-member replica set, all four secondary membershave copies of the primary’s data set, but one of the secondary membersis hidden.

Diagram of a 5 member replica set with a hidden priority 0 member.

Behavior

Read Operations

Clients will not distribute reads with the appropriate readpreference to hidden members. As a result, thesemembers receive no traffic other than basic replication. Use hiddenmembers for dedicated tasks such as reporting andbackups. Delayed membersshould be hidden.

In a sharded cluster, mongos do not interact with hiddenmembers.

Voting

Hidden members may vote in replica set elections. If you stop avoting hidden member, ensure that the set has an active majority or theprimary will step down.

For the purposes of backups,

  • db.fsyncLock() ensures that the data files are safe to copyusing low-level backup utilities such as cp, scp, ortar. A mongod started using the copiedfiles contains user-written data that is indistinguishable from theuser-written data on the locked mongod.

The data files of a locked mongod may change due tooperations such as journaling syncs orWiredTiger snapshots. Whilethis has no affect on the logical data (e.g. data accessed byclients), some backup utilities may detect these changes and emitwarnings or fail with errors. For more information on MongoDB-recommended backup utilities and procedures, seeMongoDB Backup Methods.

Write Concern

Hidden replica set members can acknowledge write operations issuedwith w: <number>. For write operationsisued with w : "majority", however,hidden members must also be voting members (i.e. members[n].votesgreater than 0) to acknowledge the "majority" write operation.Non-voting replica set members (i.e. members[n].votesis 0) cannot contribute to acknowledging write operations withmajority write concern.

Further Reading

For more information about backing up MongoDB databases,see MongoDB Backup Methods. To configure a hidden member, seeConfigure a Hidden Replica Set Member.