组复制使您能够通过将系统状态复制到一组服务器来创建具有冗余的容错系统。即使某些服务器随后发生故障,只要不是全部或大多数,系统仍然可用。根据故障服务器的数量,组的性能或可扩展性可能会降低,但系统仍然可用。服务器故障是隔离和独立的。它们由组成员服务跟踪,该服务依赖于分布式故障检测器,能够在任何服务器离开组时发出信号,无论是自愿离开还是由于意外停止。存在分布式恢复过程,以确保当服务器加入组时,它们能够自动更新到最新状态。无需服务器接管,且多源更新的特性确保即使在单个服务器故障的情况下,更新也不会被阻塞。总而言之,MySQL 组复制保证数据库服务持续可用。Group Replication enables you to create fault-tolerant systems with redundancy by replicating the system state to a set of servers. Even if some of the servers subsequently fail, as long it is not all or a majority, the system is still available. Depending on the number of servers which fail the group might have degraded performance or scalability, but it is still available. Server failures are isolated and independent. They are tracked by a group membership service which relies on a distributed failure detector that is able to signal when any servers leave the group, either voluntarily or due to an unexpected halt. There is a distributed recovery procedure to ensure that when servers join the group they are brought up to date automatically. There is no need for server failover, and the multi-source update everywhere nature ensures that even updates are not blocked in the event of a single server failure. To summarize, MySQL Group Replication guarantees that the database service is continuously available.
重要的是要理解,尽管数据库服务可用,但在发生意外服务器退出的情况下,连接到该服务的客户端必须被重定向或故障切换到另一台服务器。Group Replication 并不尝试解决这个问题。连接器、负载均衡器、路由器或某些形式的中间件更适合处理此问题。例如,请参见 MySQL Router 8.4。It is important to understand that although the database service is available, in the event of an unexpected server exit, those clients connected to it must be redirected, or failed over, to a different server. This is not something Group Replication attempts to resolve. A connector, load balancer, router, or some form of middleware are more suitable to deal with this issue. For example see MySQL Router 8.4.
总之,MySQL Group Replication 提供了高可用、高弹性、可靠的 MySQL 服务。To summarize, MySQL Group Replication provides a highly available, highly elastic, dependable MySQL service.
要部署多个 MySQL 实例,您可以使用 InnoDB 集群,它使您能够在 MySQL Shell 中轻松管理一组 MySQL 服务器实例。InnoDB 集群在编程环境中封装了 MySQL 群组复制,使您可以轻松部署 MySQL 实例集群以实现高可用性。此外,InnoDB 集群可以与 MySQL Router 无缝接口,使您的应用程序无需编写自己的故障转移流程即可连接到集群。然而,对于不需要高可用性的类似用例,您可以使用 InnoDB 副本集。MySQL Shell 的安装说明可以在 这里 找到。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.
下面的示例是 Group Replication 的典型使用案例。The following examples are typical use cases for Group Replication.
弹性复制 - 需要非常灵活的复制基础设施的环境,其中服务器数量必须能够动态增长或缩减,并且尽可能减少副作用。例如,云端的数据库服务。Elastic Replication - Environments that require a very fluid replication infrastructure, where the number of servers has to grow or shrink dynamically and with as few side-effects as possible. For instance, database services for the cloud.
高可用分片 - 分片是实现写扩展的常用方法。使用 MySQL 组复制来实现高可用分片,每个分片映射到一个复制组。Highly Available Shards - Sharding is a popular approach to achieve write scale-out. Use MySQL Group Replication to implement highly available shards, where each shard maps to a replication group.
异步源-副本复制的替代方案 - 在某些情况下,使用单个源服务器会成为唯一的争用点。在某些情况下,对整个组进行写操作可能表现出更好的可扩展性。Alternative to asynchronous Source-Replica replication - In certain situations, using a single source server makes it a single point of contention. Writing to an entire group may prove more scalable under certain circumstances.
自主系统 - 此外,您可以仅为复制协议中内置的自动化(在本章和前几章中已描述)而部署 MySQL 群组复制。Autonomic Systems - Additionally, you can deploy MySQL Group Replication purely for the automation that is built into the replication protocol (described already in this and previous chapters).