8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 20 组复制 / 20.1 组复制背景 / 20.1.5 组复制插件架构
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

20.1.5 组复制插件架构20.1.5 Group Replication Plugin Architecture

MySQL 组复制是一个 MySQL 插件,它建立在现有的 MySQL 复制基础设施之上,利用了二进制日志、基于行的日志记录和全局事务标识符等功能。它与当前的 MySQL 框架集成,例如性能模式或插件及服务基础设施。下图展示了 MySQL 组复制的总体架构的框图。MySQL Group Replication is a MySQL plugin and it builds on the existing MySQL replication infrastructure, taking advantage of features such as the binary log, row-based logging, and global transaction identifiers. It integrates with current MySQL frameworks, such as the performance schema or plugin and service infrastructures. The following figure presents a block diagram depicting the overall architecture of MySQL Group Replication.

图 20.6 组复制插件框图Figure 20.6 Group Replication Plugin Block Diagram

The text following the figure describes the content of the diagram.

MySQL Group Replication 插件包含一组用于捕获、应用和生命周期的 API,这些 API 控制插件与 MySQL 服务器的交互方式。有一些接口用于使信息从服务器流向插件,反之亦然。这些接口将 MySQL 服务器核心与 Group Replication 插件隔离开来,并且主要是放置在事务执行管道中的钩子。在一个方向上,从服务器到插件,有一些事件通知,例如服务器启动、服务器恢复、服务器准备好接受连接以及服务器即将提交事务。在另一个方向上,插件指示服务器执行诸如提交或中止正在进行的事务,或将事务排队到中继日志等操作。The MySQL Group Replication plugin includes a set of APIs for capture, apply, and lifecycle, which control how the plugin interacts with MySQL Server. There are interfaces to make information flow from the server to the plugin and vice versa. These interfaces isolate the MySQL Server core from the Group Replication plugin, and are mostly hooks placed in the transaction execution pipeline. In one direction, from server to the plugin, there are notifications for events such as the server starting, the server recovering, the server being ready to accept connections, and the server being about to commit a transaction. In the other direction, the plugin instructs the server to perform actions such as committing or aborting ongoing transactions, or queuing transactions in the relay log.

组复制插件架构的下一层是一组在通知路由到它们时会作出反应的组件。捕获组件负责跟踪正在执行的事务相关的上下文。应用组件负责在数据库上执行远程事务。恢复组件管理分布式恢复,并负责通过选择捐赠者、管理追赶程序并对捐赠者故障作出反应,使加入组的服务器保持最新状态。The next layer of the Group Replication plugin architecture is a set of components that react when a notification is routed to them. The capture component is responsible for keeping track of context related to transactions that are executing. The applier component is responsible for executing remote transactions on the database. The recovery component manages distributed recovery, and is responsible for getting a server that is joining the group up to date by selecting the donor, managing the catch up procedure and reacting to donor failures.

继续深入堆栈,复制协议模块包含复制协议的具体逻辑。它处理冲突检测,并接收和传播事务到组中。Continuing down the stack, the replication protocol module contains the specific logic of the replication protocol. It handles conflict detection, and receives and propagates transactions to the group.

Group Replication 插件架构的最后两个层是组通信系统 (GCS) API,以及基于 Paxos 的组通信引擎 (XCom) 的实现。GCS API 是一个高级 API,它抽象了构建复制状态机所需的属性(参见 第 20.1 节,“Group Replication 背景”)。因此,它将消息层的实现与插件其余上层解耦开来。组通信引擎负责与复制组成员的通信。The final two layers of the Group Replication plugin architecture are the Group Communication System (GCS) API, and an implementation of a Paxos-based group communication engine (XCom). The GCS API is a high level API that abstracts the properties required to build a replicated state machine (see Section 20.1, “Group Replication Background”). It therefore decouples the implementation of the messaging layer from the remaining upper layers of the plugin. The group communication engine handles communications with the members of the replication group.