On this page本页内容
A hidden member maintains a copy of the primary's data set but is invisible to client applications. 隐藏成员维护primary数据集的副本,但对客户端应用程序不可见。Hidden members are good for workloads with different usage patterns from the other members in the replica set. 隐藏成员适用于使用模式与副本集中其他成员不同的工作负载。Hidden members must always be priority 0 members and so cannot become primary. 隐藏成员必须始终是优先级为0的成员,因此不能成为主要成员。The db.hello()
method does not display hidden members. db.hello()
方法不显示隐藏成员。Hidden members, however, may vote in elections.然而,隐藏成员可以在选举中投票。
In the following five-member replica set, all four secondary members have copies of the primary's data set, but one of the secondary members is hidden.在下面的五个成员副本集中,所有四个辅助成员都有主成员数据集的副本,但其中一个辅助成员是隐藏的。
Clients will not distribute reads with the appropriate read preference to hidden members. 客户端不会将具有适当读取首选项的读取分发给隐藏成员。As a result, these members receive no traffic other than basic replication. 因此,除了基本复制之外,这些成员不会接收任何流量。Use hidden members for dedicated tasks such as reporting and backups.将隐藏成员用于专用任务,如报告和备份。
If your replica set contains delayed members ensure that the delayed members are hidden and non-voting.如果您的副本集包含延迟成员,请确保延迟成员是隐藏的且无投票权。
Hiding delayed replica set members prevents applications from seeing and querying delayed data without a direct connection to that member. 隐藏延迟副本集成员可防止应用程序在没有直接连接到该成员的情况下查看和查询延迟数据。Making delayed replica set members non-voting means they will not count towards acknowledging write operations with write concern 使延迟副本集成员无投票权意味着他们将不计入以"majority"
."majority"
方式确认写操作。
If you do not hide delayed members and one or more nodes become unavailable, the replica set has to wait for the delayed member and the commit point lags. 如果不隐藏延迟的成员,并且一个或多个节点不可用,则副本集必须等待延迟的成员和提交点延迟。A lagged commit point can lead to performance issues.延迟的提交点可能会导致性能问题。
For example, consider a Primary-Secondary-Delayed replica set configuration where the delayed secondary is voting with a 10 minute delay.例如,考虑一个主辅助延迟副本集配置,其中延迟的辅助以10分钟的延迟进行投票。
With one non-delayed secondary unavailable, the degraded configuration of Primary-Delayed must wait at least 10 minutes to acknowledge a write operation with 在一个非延迟的辅助设备不可用的情况下,主延迟的降级配置必须等待至少10分钟才能确认具有"majority"
."majority"
的写入操作。The majority commit point will take longer to advance, leading to cache pressure similar performance issues with a Primary with a Secondary and an Arbiter(PSA) replica set.大多数提交点将需要更长的时间来推进,这导致缓存压力与主副本集、辅助副本集和仲裁器(PSA)副本集的性能问题类似。
For more information on the majority commit point, see Causal Consistency and Read and Write Concerns. 有关多数提交点的更多信息,请参阅因果一致性和读写关注。For additional details on resolving performance issues see the replica set maintenance tutorial.有关解决性能问题的其他详细信息,请参阅副本集维护教程。
In a sharded cluster, 在分片集群中,mongos
do not interact with hidden members.mongos
不与隐藏成员交互。
Hidden members may vote in replica set elections. 隐藏成员可以在副本集选举中投票。If you stop a voting hidden member, ensure that the set has an active majority or the primary will step down.如果你阻止了一个投票隐藏的成员,请确保该集拥有活跃的多数票,否则primary将下台。
For the purposes of backups,为了备份的目的,
db.fsyncLock()
cp
, scp
, or tar
. cp
、scp
或tar
)可以安全地复制数据文件。A mongod
mongod
.mongod
上的用户写入的数据无法区分。mongod
may change due to operations such as journaling syncs or WiredTiger snapshots. mongod
的数据文件可能会因日志同步或WiredTiger快照等操作而更改。Hidden replica set members can acknowledge write operations issued with 隐藏的副本集成员可以确认使用w: <number>
. w: <number>
发出的写入操作。For write operations issued with 然而,对于用w : "majority"
, however, hidden members must also be voting members (i.e. members[n].votes
greater than 0
) to acknowledge the "majority"
write operation. w : "majority"
发出的写入操作,隐藏成员也必须是有投票权的成员(即members[n].votes
大于0
)才能确认"majority"
写入操作。Non-voting replica set members (i.e. 无投票权的副本集成员(即members[n].votes
is 0
) cannot contribute to acknowledging write operations with majority
write concern.members[n].votes
为0
)无法帮助确认具有"majority"
写入关注点的写操作。
For more information about backing up MongoDB databases, see MongoDB Backup Methods. 有关备份MongoDB数据库的详细信息,请参阅MongoDB备份方法。To configure a hidden member, see Configure a Hidden Replica Set Member.要配置隐藏成员,请参阅配置隐藏副本集成员。