Docs 菜单

隐藏的副本集成员

在此页面上

A hidden member maintains a copy of the primary's data set but is invisible to client applications. Hidden members are good for workloads with different usage patterns from the other members in the 复制集. Hidden members must always be priority 0 members and so cannot become primary. The db.hello() method does not display hidden members. Hidden members, however, may vote in elections.

You can only read from a hidden member if you directly connect to the node. If you connect to a cluster without directly connecting to the hidden node, you cannot run queries on the hidden node. 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.

隐藏延迟的副本集节点可以防止应用程序在没有直接连接到该节点的情况下查看和查询延迟数据。使延迟的副本集节点不投票意味着它们不会计入确认具有写关注 "majority" 的写入操作。

如果不隐藏延迟节点,并且一个或多个节点变得不可用,则副本集必须等待延迟节点并且提交点会延迟。延迟提交点可能会导致性能问题。

例如,考虑主节点-从节点-延迟的副本集配置,其中延迟的从节点延迟 10 分钟进行投票。

在一个非延迟从节点不可用的情况下,主节点-延迟节点的降级配置必须等待至少 10 分钟,才能确认使用 "majority" 的写入操作。多数提交点将需要更长的时间才能推进,从而导致具有从节点和仲裁节点的主节点 (PSA) 副本集出现类似缓存压力的性能问题。

有关多数提交点的更多信息,请参阅因果一致性和读写关注。有关解决性能问题的其他详细信息,请参阅副本集维护教程

In a sharded cluster, mongos do not interact with hidden members.

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 主节点 will step down.

For the purposes of backups,

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

    锁定mongod的数据文件可能会因日志同步WiredTiger快照等操作而发生变化。 虽然这对逻辑数据(例如 客户端访问的数据),但某些备份实用程序可能会检测到这些更改并发出警告,或者失败并显示错误。 有关MongoDB的更多信息 - 推荐的备份实用程序和过程,请参阅自管理部署的备份方法。

Hidden replica set members can acknowledge write operations issued with 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. Non-voting replica set members (i.e. members[n].votes is 0) cannot contribute to acknowledging write operations with majority write concern.

For more information about backing up MongoDB databases, see 自管理部署的备份方法. To configure a hidden member, see 配置隐藏的自管理副本集成员.

在此页面上