8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 24 InnoDB 副本集
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

第 24 章 InnoDB 副本集Chapter 24 InnoDB ReplicaSet

本章介绍 MySQL InnoDB ReplicaSet,它结合了 MySQL 技术,使您能够部署和管理 第 19 章,复制。本内容是 InnoDB ReplicaSet 的高层概述,完整文档请参见 MySQL InnoDB ReplicaSet。This chapter introduces MySQL InnoDB ReplicaSet, which combines MySQL technologies to enable you to deploy and administer Chapter 19, Replication. This content is a high-level overview of InnoDB ReplicaSet, for full documentation, see MySQL InnoDB ReplicaSet.

一个 InnoDB ReplicaSet 由至少两个 MySQL 服务器实例组成,并提供您熟悉的所有 MySQL 复制功能,例如读取扩展和数据安全。InnoDB ReplicaSet 使用以下 MySQL 技术:An InnoDB ReplicaSet consists of at least two MySQL Server instances, and it provides all of the MySQL Replication features you are familiar with, such as read scale-out and data security. InnoDB ReplicaSet uses the following MySQL technologies:

  • MySQL Shell,这是 MySQL 的一个高级客户端和代码编辑器。MySQL Shell, which is an advanced client and code editor for MySQL.

  • MySQL 服务器,以及第 19 章,复制,它使一组 MySQL 实例能够提供可用性和异步读扩展。InnoDB ReplicaSet 提供了一种替代、易于使用的编程方式来操作复制。MySQL Server, and Chapter 19, Replication, which enables a set of MySQL instances to provide availability and asynchronous read scale-out. InnoDB ReplicaSet provides an alternative, easy to use programmatic way to work with Replication.

  • MySQL Router,一个轻量级中间件,提供在应用程序与 InnoDB ReplicaSet 之间的透明路由。MySQL Router, a lightweight middleware that provides transparent routing between your application and InnoDB ReplicaSet.

InnoDB ReplicaSet 的接口类似于MySQL InnoDB 集群,你使用 MySQL Shell 将 MySQL 服务器实例作为 ReplicaSet 进行管理,MySQL Router 也以与 InnoDB 集群相同的方式紧密集成。The interface to an InnoDB ReplicaSet is similar to MySQL InnoDB Cluster, you use MySQL Shell to work with MySQL Server instances as a ReplicaSet, and MySQL Router is also tightly integrated in the same way as InnoDB Cluster.

基于 MySQL 复制,InnoDB 副本集(ReplicaSet)有一个主节点,它会向一个或多个从节点进行复制。InnoDB 副本集并不提供 InnoDB 集群所提供的所有功能,例如自动故障转移或多主模式。但它确实支持类似的功能,例如配置、添加和移除实例。您可以在发生故障时手动切换或故障转移到从节点。您甚至可以采用现有的复制部署,然后将其作为 InnoDB 副本集进行管理。Being based on MySQL Replication, an InnoDB ReplicaSet has a single primary, which replicates to one or more secondary instances. An InnoDB ReplicaSet does not provide all of the features which InnoDB Cluster provides, such as automatic failover, or multi-primary mode. But, it does support features such as configuring, adding, and removing instances in a similar way. You can manually switch over or fail over to a secondary instance, for example in the event of a failure. You can even adopt an existing Replication deployment and then administer it as an InnoDB ReplicaSet.

您使用 InnoDB ReplicaSet 与 AdminAPI,该 API 是 MySQL Shell 的一部分。AdminAPI 提供 JavaScript 和 Python 版本,非常适合用于脚本编写和 MySQL 部署的自动化,以实现高可用性和可扩展性。通过使用 MySQL Shell 的 AdminAPI,您可以避免手动配置多个实例。相反,AdminAPI 提供了一个有效的现代化接口,用于管理 MySQL 实例集合,并能够从一个集中工具来配置、管理和监控您的部署。You work with InnoDB ReplicaSet using the AdminAPI, provided as part of MySQL Shell. AdminAPI is available in JavaScript and Python, and is well suited to scripting and automation of deployments of MySQL to achieve high-availability and scalability. By using MySQL Shell's AdminAPI, you can avoid the need to configure many instances manually. Instead, AdminAPI provides an effective modern interface to sets of MySQL instances and enables you to provision, administer, and monitor your deployment from one central tool.

要开始使用 InnoDB 副本集,你需要下载并安装 MySQL Shell。你需要一些已经安装了 MySQL Server 实例的主机,你也可以安装 MySQL Router。To get started with InnoDB ReplicaSet you need to download and install MySQL Shell. You need some hosts with MySQL Server instances installed, and you can also install MySQL Router.

InnoDB 副本集支持 MySQL 克隆,使您能够轻松地提供实例。过去,在新实例加入 MySQL 复制部署之前,您需要以某种方式手动将事务传输到加入的实例中。这可能涉及制作文件副本、手动复制它们等等。您只需 将实例添加 到副本集中,它就会自动进行配置。InnoDB ReplicaSet supports MySQL Clone, which enables you to provision instances simply. In the past, to provision a new instance before it joined a MySQL Replication deployment, you would need to somehow manually transfer the transactions to the joining instance. This could involve making file copies, manually copying them, and so on. You can simply add an instance to the replica set and it is automatically provisioned.

类似地,InnoDB 副本集与 MySQL Router 紧密集成,您可以使用 AdminAPI 与它们一起 协作。MySQL Router 可以基于 InnoDB 副本集自动配置自身,这个过程称为 引导,无需您手动配置路由。然后,MySQL Router 可以透明地将客户端应用程序连接到 InnoDB 副本集,为客户端连接提供路由和负载均衡。这种集成还使您能够使用 AdminAPI 管理某些在 InnoDB 副本集上引导的 MySQL Router 的功能。InnoDB 副本集状态信息包括有关已在副本集上引导的 MySQL Router 的详细信息。操作功能使您能够在副本集级别 创建 MySQL Router 用户,与在副本集上引导的 MySQL Router 一起工作,等等。Similarly, InnoDB ReplicaSet is tightly integrated with MySQL Router, and you can use AdminAPI to work with them together. MySQL Router can automatically configure itself based on an InnoDB ReplicaSet, in a process called bootstrapping, which removes the need for you to configure routing manually. MySQL Router then transparently connects client applications to the InnoDB ReplicaSet, providing routing and load-balancing for client connections. This integration also enables you to administer some aspects of a MySQL Router bootstrapped against an InnoDB ReplicaSet using AdminAPI. InnoDB ReplicaSet status information includes details about MySQL Routers bootstrapped against the ReplicaSet. Operations enable you to create MySQL Router users at the ReplicaSet level, to work with the MySQL Routers bootstrapped against the ReplicaSet, and so on.

有关这些技术的更多信息,请参阅描述中链接的用户文档。除了这些用户文档之外,所有 AdminAPI 方法的开发者文档均可在 MySQL Shell JavaScript API 参考或 MySQL Shell Python API 参考中找到,可从 连接器和 API 获取。For more information on these technologies, see the user documentation linked in the descriptions. In addition to this user documentation, there is developer documentation for all AdminAPI methods in the MySQL Shell JavaScript API Reference or MySQL Shell Python API Reference, available from Connectors and APIs.