MySql 中文参考指南
Chapter 20 Group Replication
目录
Table of Contents
本章解释了 MySQL 9.0 中的组复制,以及如何安装、配置和监控组。MySQL 组复制使您能够创建弹性、高可用性、容错复制拓扑。
This chapter explains Group Replication in MySQL 9.0, and how to install, configure and monitor groups. MySQL Group Replication enables you to create elastic, highly-available, fault-tolerant replication topologies.
组可以在具有自动主选的单主模式下操作,其中一次只有一个服务器接受更新。或者,组可以部署在多主模式中,其中所有服务器都可以接受更新,即使它们是并发发出的。
Groups can operate in a single-primary mode with automatic primary election, where only one server accepts updates at a time. Alternatively, groups can be deployed in multi-primary mode, where all servers can accept updates, even if they are issued concurrently.
有一个内置的组成员身份服务,可使组的视图一致,并在任何给定的时间点对所有服务器可用。服务器可以离开并加入该组,并且视图会相应更新。有时服务器会意外离开该组,在这种情况下,故障检测机制会检测到此情况,并通知组视图已更改。这一切都是自动的。
There is a built-in group membership service that keeps the view of the group consistent and available for all servers at any given point in time. Servers can leave and join the group and the view is updated accordingly. Sometimes servers can leave the group unexpectedly, in which case the failure detection mechanism detects this and notifies the group that the view has changed. This is all automatic.
组复制可以确保数据库服务持续可用。然而,了解到如果其中一个组成员不可用,那么连接到该组成员的客户端必须重新定向,或故障转移到组中的另一个服务器(使用连接器、负载平衡器、路由器,或某种形式的中间件)。组复制没有内置方法来执行此操作。例如,请参阅 MySQL Router 9.0。
Group Replication guarantees that the database service is continuously available. However, it is important to understand that if one of the group members becomes unavailable, the clients connected to that group member must be redirected, or failed over, to a different server in the group, using a connector, load balancer, router, or some form of middleware. Group Replication does not have an inbuilt method to do this. For example, see MySQL Router 9.0.
组复制作为插件提供给 MySQL 服务器。您可以按照本章中的说明在组中所需的每个服务器实例上配置插件,启动组,并监控和管理组。部署 MySQL 服务器实例组的另一种方法是使用 InnoDB 集群。
Group Replication is provided as a plugin to MySQL Server. You can follow the instructions in this chapter to configure the plugin on each of the server instances that you want in the group, start up the group, and monitor and administer the group. An alternative way to deploy a group of MySQL server instances is by using InnoDB Cluster.
要部署 MySQL 的多个实例,您可以使用 InnoDB Cluster,这样您就可以在 MySQL Shell 中轻松管理一组 MySQL 服务器实例。InnoDB 集群将 MySQL 组复制封装在一个编程环境中,使您可以轻松部署 MySQL 实例集群以实现高可用性。此外,InnoDB 集群与 MySQL Router 无缝衔接,使您的应用程序能够连接到集群,而无需编写自己的故障转移过程。但是,对于不需要高可用性的类似用例,您可以使用 InnoDB ReplicaSet。MySQL Shell 的安装说明可在 here 中找到。
To deploy multiple instances of MySQL, you can use InnoDB Cluster which enables you to easily administer a group of MySQL server instances in MySQL Shell. InnoDB Cluster wraps MySQL Group Replication in a programmatic environment that enables you easily deploy a cluster of MySQL instances to achieve high availability. In addition, InnoDB Cluster interfaces seamlessly with MySQL Router, which enables your applications to connect to the cluster without writing your own failover process. For similar use cases that do not require high availability, however, you can use InnoDB ReplicaSet. Installation instructions for MySQL Shell can be found here.
本章的结构如下:
The chapter is structured as follows:
-
Section 20.1, “Group Replication Background” provides an introduction to groups and how Group Replication works.
-
Section 20.2, “Getting Started” explains how to configure multiple MySQL Server instances to create a group.
-
Section 20.3, “Requirements and Limitations” explains architecture and setup requirements and limitations for Group Replication.
-
Section 20.4, “Monitoring Group Replication” explains how to monitor a group.
-
Section 20.5, “Group Replication Operations” explains how to work with a group.
-
Section 20.6, “Group Replication Security” explains how to secure a group.
-
Section 20.7, “Group Replication Performance and Troubleshooting” explains how to fine tune performance for a group.
-
Section 20.8, “Upgrading Group Replication” explains how to upgrade a group.
-
Section 20.9, “Group Replication Variables” is a reference for the system variables specific to Group Replication.
-
Section 20.10, “Frequently Asked Questions” provides answers to some technical questions about deploying and operating Group Replication.