8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

20.7.3 单一共识领导者20.7.3 Single Consensus Leader

默认情况下,组复制的组通信引擎(XCom,一种 Paxos 变体)使用复制组中的每个成员作为领导者。组通信引擎可以在组处于单主模式时使用单一领导者来推动共识。在单主模式下使用单一共识领导者可以提高性能和弹性,尤其是在组的一些辅助成员当前无法访问的情况下。By default, the group communication engine for Group Replication (XCom, a Paxos variant) operates using every member of the replication group as a leader. The group communication engine can use a single leader to drive consensus when the group is in single-primary mode. Operating with a single consensus leader improves performance and resilience in single-primary mode, particularly when some of the group’s secondary members are currently unreachable.

要使用单个共识领导者,必须将组配置如下:To use a single consensus leader, the group must be configured as follows:

当此配置启用时,组复制会指示组通信引擎使用组的主节点作为单一的领导者来推动共识。当选出新的主节点时,组复制会告诉组通信引擎改用新的主节点。如果主节点当前不可用,组通信引擎会使用其他成员作为共识领导者。性能模式表 replication_group_communication_information 显示当前的首选和实际共识领导者,首选领导者是组复制选择的领导者,实际领导者则是由组通信引擎选出的领导者。When this configuration is in place, Group Replication instructs the group communication engine to use the group’s primary as the single leader to drive consensus. When a new primary is elected, Group Replication tells the group communication engine to use it instead. If the primary is currently unhealthy, the group communication engine uses an alternative member as the consensus leader. The Performance Schema table replication_group_communication_information shows the current preferred and actual consensus leader, with the preferred leader being Group Replication’s choice, and the actual leader being the one selected by the group communication engine.

如果组处于多主模式,具有较低的通信协议版本,或该行为被 group_replication_paxos_single_leader 设置禁用,则所有成员都用作领导者来推动共识。在这种情况下,Performance Schema 表 replication_group_communication_information 会显示所有成员既是首选领导者又是实际领导者。If the group is in multi-primary mode, has a lower communication protocol version, or the behavior is disabled by the group_replication_paxos_single_leader setting, all members are used as leaders to drive consensus. In this situation, the Performance Schema table replication_group_communication_information shows all of the members as both the preferred and actual leaders.

Performance Schema 表 replication_group_communication_information 中的 WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE 列显示该组是否支持使用单一领导者,即使在被查询成员上 group_replication_paxos_single_leader 当前设置为 OFF。如果该组在启动时 group_replication_paxos_single_leader 设置为 ON,且其通信协议版本为 MySQL 8.0.27 及以上,则该列值为 1。此信息仅返回处于 ONLINE 或 RECOVERING 状态的组成员。The WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE column of the Performance Schema table replication_group_communication_information shows whether the group supports the use of a single leader, even if group_replication_paxos_single_leader is currently set to OFF on the queried member. The column value is 1 if the group was started with group_replication_paxos_single_leader set to ON, and its communication protocol version is MySQL 8.0.27 or above. This information is returned only for group members in ONLINE or RECOVERING state.