在以下部分中,我们解答有关 MySQL NDB 集群和 NDB 存储引擎的常见问题。In the following section, we answer questions that are frequently
asked about MySQL NDB Cluster and the
NDB storage engine.
- A.10.1. 哪些版本的 MySQL 软件支持 NDB 集群?我是否需要从源码编译? A.10.1. Which versions of the MySQL software support NDB Cluster? Do I have to compile from source?
- A.10.2. “NDB”和“NDBCLUSTER”是什么意思? A.10.2. What do “NDB” and “NDBCLUSTER” mean?
- A.10.3. 使用 NDB 集群与使用 MySQL 复制有什么区别? A.10.3. What is the difference between using NDB Cluster versus using MySQL Replication?
- A.10.4. 运行 NDB 集群需要特殊的网络配置吗?集群中的计算机如何通信? A.10.4. Do I need any special networking to run NDB Cluster? How do computers in a cluster communicate?
- A.10.5. 运行 NDB 集群需要多少台计算机,为什么? A.10.5. How many computers do I need to run an NDB Cluster, and why?
- A.10.6. NDB 集群中不同的计算机分别做什么? A.10.6. What do the different computers do in an NDB Cluster?
- A.10.7. 当我在 NDB 集群管理客户端运行 SHOW 命令时,我看到如下的一行输出: A.10.7. When I run the SHOW command in the NDB Cluster management client, I see a line of output that looks like this:
- A.10.8. NDB 集群可以在哪些操作系统上使用? A.10.8. With which operating systems can I use NDB Cluster?
- A.10.9. 运行 NDB Cluster 的硬件要求是什么? A.10.9. What are the hardware requirements for running NDB Cluster?
- A.10.10. 使用 NDB Cluster 需要多少内存?是否可以使用磁盘内存? A.10.10. How much RAM do I need to use NDB Cluster? Is it possible to use disk memory at all?
- A.10.11. 可以使用哪些文件系统与 NDB Cluster?网络文件系统或网络共享呢? A.10.11. What file systems can I use with NDB Cluster? What about network file systems or network shares?
- A.10.12. 可以在虚拟机(如 VMWare、VirtualBox、Parallels 或 Xen 创建的虚拟机)中运行 NDB Cluster 节点吗? A.10.12. Can I run NDB Cluster nodes inside virtual machines (such as those created by VMWare, VirtualBox, Parallels, or Xen)?
- A.10.13. 我正在尝试填充 NDB Cluster 数据库。加载过程提前终止,并显示如下错误信息: A.10.13. I am trying to populate an NDB Cluster database. The loading process terminates prematurely and I get an error message like this one:
- A.10.14. NDB Cluster 使用 TCP/IP。这是否意味着我可以通过互联网运行它,并且在远程位置有一个或多个节点?A.10.14. NDB Cluster uses TCP/IP. Does this mean that I can run it over the Internet, with one or more nodes in remote locations?
- A.10.15. 使用 NDB Cluster 是否必须学习一种新的编程或查询语言?A.10.15. Do I have to learn a new programming or query language to use NDB Cluster?
- A.10.16. NDB Cluster 支持哪些编程语言和 API?A.10.16. What programming languages and APIs are supported by NDB Cluster?
- A.10.17. NDB Cluster 是否包含任何管理工具?A.10.17. Does NDB Cluster include any management tools?
- A.10.18. 使用 NDB Cluster 时,我如何了解错误或警告信息的含义?A.10.18. How do I find out what an error or warning message means when using NDB Cluster?
- A.10.19. NDB Cluster 是事务安全的吗?支持哪些隔离级别?A.10.19. Is NDB Cluster transaction-safe? What isolation levels are supported?
- A.10.20. NDB Cluster 支持哪些存储引擎?A.10.20. What storage engines are supported by NDB Cluster?
- A.10.21. 如果发生灾难性故障——例如整座城市停电且我的 UPS 也失效——我会丢失所有数据吗?A.10.21. In the event of a catastrophic failure— for example, the whole city loses power and my UPS fails—would I lose all my data?
- A.10.22. NDB Cluster 可以使用 FULLTEXT 索引吗?A.10.22. Is it possible to use FULLTEXT indexes with NDB Cluster?
- A.10.23. 我可以在一台电脑上运行多个节点吗?A.10.23. Can I run multiple nodes on a single computer?
- A.10.24. 我可以在不重启的情况下向 NDB Cluster 添加数据节点吗? A.10.24. Can I add data nodes to an NDB Cluster without restarting it?
- A.10.25. 使用 NDB Cluster 时,我需要注意哪些限制? A.10.25. Are there any limitations that I should be aware of when using NDB Cluster?
- A.10.26. NDB Cluster 支持外键吗? A.10.26. Does NDB Cluster support foreign keys?
- A.10.27. 我如何将现有的 MySQL 数据库导入到 NDB Cluster? A.10.27. How do I import an existing MySQL database into an NDB Cluster?
- A.10.28. NDB Cluster 节点之间如何进行通信? A.10.28. How do NDB Cluster nodes communicate with one another?
- A.10.29. 仲裁器是什么? A.10.29. What is an arbitrator?
- A.10.30. NDB Cluster 支持哪些数据类型? A.10.30. What data types are supported by NDB Cluster?
- A.10.31. 如何启动和停止 NDB Cluster? A.10.31. How do I start and stop NDB Cluster?
- A.10.32. 当 NDB Cluster 关闭时,数据会发生什么? A.10.32. What happens to NDB Cluster data when the cluster is shut down?
- A.10.33. 为 NDB Cluster 配置多个管理节点是否是个好主意? A.10.33. Is it a good idea to have more than one management node for an NDB Cluster?
- A.10.34. 我可以在一个 NDB Cluster 中混合不同类型的硬件和操作系统吗? A.10.34. Can I mix different kinds of hardware and operating systems in one NDB Cluster?
- A.10.35. 我可以在单台主机上运行两个数据节点吗?两个 SQL 节点呢? A.10.35. Can I run two data nodes on a single host? Two SQL nodes?
- A.10.36. 我可以在 NDB 集群中使用主机名吗? A.10.36. Can I use host names with NDB Cluster?
- A.10.37. NDB 集群支持 IPv6 吗? A.10.37. Does NDB Cluster support IPv6?
- A.10.38. 在具有多个 MySQL 服务器的 NDB 集群中,我如何管理 MySQL 用户? A.10.38. How do I handle MySQL users in an NDB Cluster having multiple MySQL servers?
- A.10.39. 如果其中一个 SQL 节点失败,我如何继续发送查询? A.10.39. How do I continue to send queries in the event that one of the SQL nodes fails?
- A.10.40. 我如何备份和恢复 NDB 集群? A.10.40. How do I back up and restore an NDB Cluster?
- A.10.41. 什么是“天使进程”? A.10.41. What is an “angel process”?
A.10.1. | 哪些版本的 MySQL 软件支持 NDB Cluster?我需要从源代码编译吗?Which versions of the MySQL software support NDB Cluster? Do I have to compile from source? |
标准 MySQL Server 版本不支持 NDB Cluster。相反,MySQL NDB Cluster 作为一个独立产品提供。可用的 NDB Cluster 发布系列包括以下内容:NDB Cluster is not supported in standard MySQL Server releases. Instead, MySQL NDB Cluster is provided as a separate product. Available NDB Cluster release series include the following:
您可以从源代码获取并编译 NDB Cluster(请参阅 第 25.3.1.4 节,“在 Linux 上从源代码构建 NDB Cluster”,以及 第 25.3.2.2 节,“在 Windows 上从源代码编译和安装 NDB Cluster”),但除非是最专业的情况,否则我们建议使用 Oracle 提供的、适合您操作平台和情况的以下安装程序之一:You can obtain and compile NDB Cluster from source (see Section 25.3.1.4, “Building NDB Cluster from Source on Linux”, and Section 25.3.2.2, “Compiling and Installing NDB Cluster from Source on Windows”), but for all but the most specialized cases, we recommend using one of the following installers provided by Oracle that is appropriate to your operating platform and circumstances:
安装包也可能通过您所在平台的软件包管理系统提供。Installation packages may also be available from your platform's package management system. 您可以使用以下语句之一来确定您的 MySQL 服务器是否支持 | |
A.10.2. | What do “NDB”以及“NDBCLUSTER” mean?What do “NDB” and “NDBCLUSTER” mean? |
“NDB” 代表 “Network Database”。 | |
A.10.3. | 使用 NDB 集群与使用 MySQL 复制有什么区别?What is the difference between using NDB Cluster versus using MySQL Replication? |
在传统的 MySQL 复制中,源 MySQL 服务器会更新一个或多个副本。事务是按顺序提交的,慢速事务可能导致副本落后于源服务器。这意味着如果源服务器发生故障,副本可能还没有记录最后几次事务。如果使用的是事务安全引擎,例如 简而言之,标准的 MySQL 复制是 异步),而 NDB 集群则是 synchronous。In short, whereas standard MySQL replication is asynchronous, NDB Cluster is synchronous. 异步复制也可在 NDB 集群中使用。NDB 集群复制(有时也称为 “geo-replication”)包含了两个 NDB 集群之间以及从 NDB 集群复制到非集群 MySQL 服务器的能力。参见 第 25.7 节,“NDB 集群复制”。Asynchronous replication is also available in NDB Cluster. NDB Cluster Replication (also sometimes known as “geo-replication”) includes the capability to replicate both between two NDB Clusters, and from an NDB Cluster to a non-Cluster MySQL server. See Section 25.7, “NDB Cluster Replication”. | |
A.10.4. | 运行 NDB 集群需要什么特殊网络吗?集群中的计算机是如何通信的?Do I need any special networking to run NDB Cluster? How do computers in a cluster communicate? |
NDB Cluster 旨在用于高带宽环境,计算机通过 TCP/IP 连接。其性能直接取决于集群计算机之间的连接速度。NDB Cluster 的最低连接要求包括典型的 100 兆以太网网络或同等水平。我们建议在条件允许时使用千兆以太网。NDB Cluster is intended to be used in a high-bandwidth environment, with computers connecting using TCP/IP. Its performance depends directly upon the connection speed between the cluster's computers. The minimum connectivity requirements for NDB Cluster include a typical 100-megabit Ethernet network or the equivalent. We recommend you use gigabit Ethernet whenever available. | |
A.10.5. | 运行 NDB Cluster 需要多少台计算机,为什么?How many computers do I need to run an NDB Cluster, and why? |
A minimum of three computers is required to run a viable cluster. However, the minimum recommended number of computers in an NDB Cluster is four: one each to run the management and SQL nodes, and two computers to serve as data nodes. The purpose of the two data nodes is to provide redundancy; the management node must run on a separate machine to guarantee continued arbitration services in the event that one of the data nodes fails. 为了提供更高的吞吐量和高可用性,您应使用多个 SQL 节点(连接到集群的 MySQL 服务器)。也可以(虽然不是严格必要的)运行多个管理服务器。To provide increased throughput and high availability, you should use multiple SQL nodes (MySQL Servers connected to the cluster). It is also possible (although not strictly necessary) to run multiple management servers. | |
A.10.6. | NDB 集群中不同的计算机的作用是什么?What do the different computers do in an NDB Cluster? |
NDB 集群具有物理和逻辑组织,计算机是物理元素。集群的逻辑或功能元素称为节点,承载集群节点的计算机有时称为集群主机。节点有三种类型,每种对应集群中的特定角色。如以下所示:An NDB Cluster has both a physical and logical organization, with computers being the physical elements. The logical or functional elements of a cluster are referred to as nodes, and a computer housing a cluster node is sometimes referred to as a cluster host. There are three types of nodes, each corresponding to a specific role within the cluster. These are:
| |
A.10.7. | 当我在 NDB 集群管理客户端中运行 id=2 @10.100.10.32 (Version: 8.0.44-ndb-8.0.44 Nodegroup: 0, *)
|
最简单的答案是,“这不是你可以控制的事情,而且无论如何你也无需担心,除非你是一个编写或分析 NDB Cluster 源代码的软件工程师”。The simplest answer is, “It's not something you can control, and it's nothing that you need to worry about in any case, unless you're a software engineer writing or analyzing the NDB Cluster source code”. 如果你觉得这个答案不够满意,这里有一个更长且更技术性的版本:If you don't find that answer satisfactory, here's a longer and more technical version: A number of mechanisms in NDB Cluster require distributed coordination among the data nodes. These distributed algorithms and protocols include global checkpointing, DDL (schema) changes, and node restart handling. To make this coordination simpler, the data nodes “elect” one of their number to act as leader. There is no user-facing mechanism for influencing this selection, which is completely automatic; the fact that it is automatic is a key part of NDB Cluster's internal architecture. 当一个节点在这些机制中的任何一个中充当“领导者”时,它通常是活动的协调点,而其他节点则充当“跟随者”,按照领导者的指示执行各自的活动部分。如果充当领导者的节点失败,则其余节点会选举新的领导者。由旧领导者协调的正在进行的任务可能会失败,也可能由新领导者继续进行,这取决于所涉及的实际机制。When a node acts as the “leader” for any of these mechanisms, it is usually the point of coordination for the activity, and the other nodes act as “followers”, carrying out their parts of the activity as directed by the leader. If the node acting as leader fails, then the remaining nodes elect a new leader. Tasks in progress that were being coordinated by the old leader may either fail or be continued by the new leader, depending on the actual mechanism involved. 这些不同的机制和协议中的一些可能有不同的领导节点,但通常所有机制都会选择相同的领导。管理客户端中通过 NDB 集群的设计方式使得领导节点的选择在集群之外没有明显影响。例如,当前的领导节点的 CPU 或资源使用率并不会比其他数据节点显著高,并且领导节点的故障对集群的影响不应显著不同于任何其他数据节点的故障。NDB Cluster is designed in such a way that the choice of leader has no discernible effect outside the cluster itself. For example, the current leader does not have significantly higher CPU or resource usage than the other data nodes, and failure of the leader should not have a significantly different impact on the cluster than the failure of any other data node. | |
A.10.8. | 我可以在哪些操作系统上使用 NDB 集群?With which operating systems can I use NDB Cluster? |
NDB 集群支持大多数类 Unix 操作系统。NDB 集群在 Microsoft Windows 操作系统的生产环境中也受到支持。NDB Cluster is supported on most Unix-like operating systems. NDB Cluster is also supported in production settings on Microsoft Windows operating systems. 有关在各种操作系统版本、操作系统发行版和硬件平台上对 NDB Cluster 支持级别的更详细信息,请参阅 https://www.mysql.com/support/supportedplatforms/cluster.html。For more detailed information concerning the level of support which is offered for NDB Cluster on various operating system versions, operating system distributions, and hardware platforms, please refer to https://www.mysql.com/support/supportedplatforms/cluster.html. | |
A.10.9. | 运行 NDB Cluster 的硬件要求是什么?What are the hardware requirements for running NDB Cluster? |
NDB 集群应可以在任何提供 | |
A.10.10. | 使用 NDB Cluster 我需要多少 RAM?完全使用磁盘内存是否可能?How much RAM do I need to use NDB Cluster? Is it possible to use disk memory at all? |
NDB Cluster 最初仅以内存方式实现,但目前所有可用版本也提供了将 NDB Cluster 存储在磁盘上的功能。更多信息参见 第 25.6.11 节,“NDB Cluster 磁盘表”。NDB Cluster was originally implemented as in-memory only, but all versions currently available also provide the ability to store NDB Cluster on disk. See Section 25.6.11, “NDB Cluster Disk Data Tables”, for more information. 对于内存中的 (SizeofDatabase × NumberOfReplicas × 1.1 ) / NumberOfDataNodes 要更精确地计算内存需求,需要确定集群数据库中每个表每行所需的存储空间(详细信息请参见第 13.7 节,“数据类型存储需求”),并将其乘以行数。您还必须记得考虑任何列索引,如下所示:To calculate the memory requirements more exactly requires determining, for each table in the cluster database, the storage space required per row (see Section 13.7, “Data Type Storage Requirements”, for details), and multiplying this by the number of rows. You must also remember to account for any column indexes as follows:
为所有主键和唯一索引创建使用 在计算集群内存需求时,您可能会发现最近 MySQL 8.4 版本提供的 ndb_size.pl 工具非常有用。该 Perl 脚本连接到当前(非集群)MySQL 数据库,并生成一份报告,说明如果该数据库使用 特别重要的是要记住,每个 NDB Cluster 表都必须有一个主键。 您可以使用 ndb_mgm 客户端中的 | |
A.10.11. | 我可以在 NDB Cluster 中使用哪些文件系统?网络文件系统或网络共享呢?What file systems can I use with NDB Cluster? What about network file systems or network shares? |
通常,任何操作系统本地的文件系统都应该能很好地与 NDB Cluster 一起使用。如果您发现某个文件系统与 NDB Cluster 的兼容性特别好(或不太理想),我们欢迎您在 NDB Cluster 论坛 上讨论您的发现。Generally, any file system that is native to the host operating system should work well with NDB Cluster. If you find that a given file system works particularly well (or not so especially well) with NDB Cluster, we invite you to discuss your findings in the NDB Cluster Forums. 对于 Windows,我们建议您像对标准 MySQL 一样,在 NDB Cluster 中使用 NDB 集群实现为无共享解决方案;其背后的理念是单个硬件的故障不应导致多个集群节点的故障,甚至可能不会导致整个集群的故障。出于这个原因,NDB 集群不支持使用网络共享或网络文件系统。这同样适用于共享存储设备,如 SAN。NDB Cluster is implemented as a shared-nothing solution; the idea behind this is that the failure of a single piece of hardware should not cause the failure of multiple cluster nodes, or possibly even the failure of the cluster as a whole. For this reason, the use of network shares or network file systems is not supported for NDB Cluster. This also applies to shared storage devices such as SANs. | |
A.10.12. | 我可以在虚拟机(例如由 VMWare、VirtualBox、Parallels 或 Xen 创建的虚拟机)中运行 NDB 集群节点吗?Can I run NDB Cluster nodes inside virtual machines (such as those created by VMWare, VirtualBox, Parallels, or Xen)? |
NDB 集群支持在虚拟机中使用。我们目前支持并测试使用 Oracle VM。NDB Cluster is supported for use in virtual machines. We currently support and test using Oracle VM. 一些 NDB Cluster 用户已经成功使用其他虚拟化产品部署了 NDB Cluster;在这种情况下,Oracle 可以提供 NDB Cluster 支持,但虚拟环境特有的问题必须咨询该产品的供应商。Some NDB Cluster users have successfully deployed NDB Cluster using other virtualization products; in such cases, Oracle can provide NDB Cluster support, but issues specific to the virtual environment must be referred to that product's vendor. | |
A.10.13. | 我正在尝试填充一个 NDB Cluster 数据库。加载过程提前终止,并且我收到如下错误信息:I am trying to populate an NDB Cluster database. The loading process terminates prematurely and I get an error message like this one:
为什么会发生这种情况?Why is this happening? |
原因很可能是您的设置没有为所有表数据和所有索引提供足够的 RAM,包括 同样值得注意的是,所有数据节点应具有相同数量的 RAM,因为集群中的任何数据节点都不能使用超过单个数据节点可用最少内存的容量。例如,如果有四台计算机托管集群数据节点,并且其中三台有 3GB RAM 可用于存储集群数据,而剩余的数据节点只有 1GB RAM,那么每个数据节点最多只能为 NDB 集群数据和索引分配 1GB。It is also worth noting that all data nodes should have the same amount of RAM, since no data node in a cluster can use more memory than the least amount available to any individual data node. For example, if there are four computers hosting Cluster data nodes, and three of these have 3GB of RAM available to store Cluster data while the remaining data node has only 1GB RAM, then each data node can devote at most 1GB to NDB Cluster data and indexes. 在某些情况下,即使使用 ndb_mgm -e "ALL REPORT MEMORYUSAGE" 显示 出于类似的原因,在数据负载较重的节点上,有时也会遇到数据节点重启的问题。 | |
A.10.14. | NDB 集群使用 TCP/IP。这是否意味着我可以在互联网上运行它,并将一个或多个节点放在远程位置?NDB Cluster uses TCP/IP. Does this mean that I can run it over the Internet, with one or more nodes in remote locations? |
It is 非常 unlikely that a cluster would perform reliably under such conditions, as NDB Cluster was designed and implemented with the assumption that it would be run under conditions guaranteeing dedicated high-speed connectivity such as that found in a LAN setting using 100 Mbps or gigabit Ethernet—preferably the latter. We neither test nor warrant its performance using anything slower than this.It is very unlikely that a cluster would perform reliably under such conditions, as NDB Cluster was designed and implemented with the assumption that it would be run under conditions guaranteeing dedicated high-speed connectivity such as that found in a LAN setting using 100 Mbps or gigabit Ethernet—preferably the latter. We neither test nor warrant its performance using anything slower than this. 此外,必须牢记,NDB 集群中节点之间的通信是不安全的;它们既不加密,也没有受到任何其他保护机制的保护。集群最安全的配置是在防火墙后的私有网络中,外部无法直接访问任何集群数据或管理节点。(对于 SQL 节点,您应采取与任何其他 MySQL 服务器实例相同的防护措施。)有关更多信息,请参见 第 25.6.19 节,“NDB 集群安全”。Also, it is extremely important to keep in mind that communications between the nodes in an NDB Cluster are not secure; they are neither encrypted nor safeguarded by any other protective mechanism. The most secure configuration for a cluster is in a private network behind a firewall, with no direct access to any Cluster data or management nodes from outside. (For SQL nodes, you should take the same precautions as you would with any other instance of the MySQL server.) For more information, see Section 25.6.19, “NDB Cluster Security”. | |
A.10.15. | 使用 NDB 集群是否需要学习新的编程或查询语言?Do I have to learn a new programming or query language to use NDB Cluster? |
不需要。虽然管理和配置集群本身需要使用一些特殊命令,但以下操作只需要标准的 (My)SQL 语句:No. Although some specialized commands are used to manage and configure the cluster itself, only standard (My)SQL statements are required for the following operations:
设置 NDB 群集需要一些特殊的配置参数和文件——有关这些的更多信息,请参见 第 25.4.3 节,“NDB 群集配置文件”。Some specialized configuration parameters and files are required to set up an NDB Cluster—see Section 25.4.3, “NDB Cluster Configuration Files”, for information about these. 在 NDB 群集管理客户端中使用一些简单的命令(ndb_mgm)来执行例如启动和停止群集节点的任务。请参见 第 25.6.1 节,“NDB 群集管理客户端中的命令”。A few simple commands are used in the NDB Cluster management client (ndb_mgm) for tasks such as starting and stopping cluster nodes. See Section 25.6.1, “Commands in the NDB Cluster Management Client”. | |
A.10.16. | NDB Cluster 支持哪些编程语言和 API?What programming languages and APIs are supported by NDB Cluster? |
NDB Cluster 支持与标准 MySQL 服务器相同的编程 API 和语言,包括 ODBC、.Net、MySQL C API,以及众多针对流行脚本语言的驱动程序,如 PHP、Perl 和 Python。使用这些 API 编写的 NDB Cluster 应用程序的行为类似于其他 MySQL 应用程序;它们将 SQL 语句传送到 MySQL 服务器(在 NDB Cluster 的情况下,是 SQL 节点),并接收包含数据行的响应。有关这些 API 的更多信息,请参见 第 31 章,连接器和 API。NDB Cluster supports the same programming APIs and languages as the standard MySQL Server, including ODBC, .Net, the MySQL C API, and numerous drivers for popular scripting languages such as PHP, Perl, and Python. NDB Cluster applications written using these APIs behave similarly to other MySQL applications; they transmit SQL statements to a MySQL Server (in the case of NDB Cluster, an SQL node), and receive responses containing rows of data. For more information about these APIs, see Chapter 31, Connectors and APIs. NDB 集群还支持使用 NDB API 进行应用程序编程,该 API 提供了一个低级的 C 接口来访问 NDB 集群数据,无需通过 MySQL 服务器。请参阅 NDB API。此外,许多 NDB 集群还支持使用 ClusterJ 进行 Java 应用程序编程,ClusterJ 使用会话和事务支持数据的领域对象模型。更多信息请参阅 Java 与 NDB Cluster。NDB Cluster also supports Java application programming using ClusterJ, which supports a domain object model of data using sessions and transactions. See Java and NDB Cluster, for more information. NDB 集群 8.0 还包括支持基于 | |
A.10.17. | NDB 集群包含任何管理工具吗?Does NDB Cluster include any management tools? |
NDB 集群包含一个命令行客户端,用于执行基本管理功能。请参阅 第 25.5.5 节,“ndb_mgm — NDB 集群管理客户端”,以及 第 25.6.1 节,“NDB 集群管理客户端中的命令”。NDB Cluster includes a command line client for performing basic management functions. See Section 25.5.5, “ndb_mgm — The NDB Cluster Management Client”, and Section 25.6.1, “Commands in the NDB Cluster Management Client”. NDB Cluster 也受到 MySQL Cluster Manager 的支持,这是一个独立的产品,提供高级命令行界面,可以自动执行许多 NDB Cluster 管理任务,例如滚动重启和配置更改。有关 MySQL Cluster Manager 的更多信息,请参见 MySQL Cluster Manager 8.4.9 用户手册。NDB Cluster is also supported by MySQL Cluster Manager, a separate product providing an advanced command line interface that can automate many NDB Cluster management tasks such as rolling restarts and configuration changes. For more information about MySQL Cluster Manager, see MySQL Cluster Manager 8.4.9 User Manual. | |
A.10.18. | 在使用 NDB Cluster 时,我如何查找错误或警告消息的含义?How do I find out what an error or warning message means when using NDB Cluster? |
可以通过两种方式来完成此操作:There are two ways in which this can be done:
| |
A.10.19. | NDB Cluster 是事务安全的吗?支持哪些隔离级别?Is NDB Cluster transaction-safe? What isolation levels are supported? |
是的。对于使用 | |
A.10.20. | NDB Cluster 支持哪些存储引擎?What storage engines are supported by NDB Cluster? |
NDB Cluster 需要 在使用 NDB 集群的 MySQL 服务器上,也可以使用其他存储引擎(例如 NDB 集群在架构、要求和实现方面与 | |
A.10.21. | 在发生灾难性故障的情况下——例如,整个城市停电并且我的 UPS 也失效——我会丢失所有数据吗?In the event of a catastrophic failure— for example, the whole city loses power and my UPS fails—would I lose all my data? |
所有已提交的事务都会被记录。因此,虽然在灾难发生时有可能丢失一些数据,但这种情况应该相当有限。通过最小化每个事务的操作数量,可以进一步减少数据丢失。(无论如何,每个事务执行大量操作都不是一个好主意。)All committed transactions are logged. Therefore, although it is possible that some data could be lost in the event of a catastrophe, this should be quite limited. Data loss can be further reduced by minimizing the number of operations per transaction. (It is not a good idea to perform large numbers of operations per transaction in any case.) | |
A.10.22. | 是否可以在 NDB Cluster 中使用 |
| |
A.10.23. | 我可以在一台计算机上运行多个节点吗?Can I run multiple nodes on a single computer? |
这是可能的,但并不总是可取的。运行集群的主要原因之一是提供冗余。为了充分利用这种冗余,每个节点应位于不同的机器上。如果你在一台机器上放置多个节点,而该机器发生故障,你将失去所有这些节点。因此,如果你确实在一台机器上运行多个数据节点,那么必须 极其 重要地将它们设置成在这台机器故障时不会导致给定节点组中的所有数据节点丢失的方式。It is possible but not always advisable. One of the chief reasons to run a cluster is to provide redundancy. To obtain the full benefits of this redundancy, each node should reside on a separate machine. If you place multiple nodes on a single machine and that machine fails, you lose all of those nodes. For this reason, if you do run multiple data nodes on a single machine, it is extremely important that they be set up in such a way that the failure of this machine does not cause the loss of all the data nodes in a given node group. 鉴于 NDB Cluster 可以在负载低成本(甚至免费的)操作系统的商用硬件上运行,为保护关键任务数据而增加一两台机器的开销是非常值得的。同时需要注意的是,运行管理节点的集群主机的要求很低。这项任务可以通过 300 MHz 的 Pentium 或同等 CPU 完成,并为操作系统提供足够的内存,加上一小部分用于 ndb_mgmd 和 ndb_mgm 进程的开销。Given that NDB Cluster can be run on commodity hardware loaded with a low-cost (or even no-cost) operating system, the expense of an extra machine or two is well worth it to safeguard mission-critical data. It also worth noting that the requirements for a cluster host running a management node are minimal. This task can be accomplished with a 300 MHz Pentium or equivalent CPU and sufficient RAM for the operating system, plus a small amount of overhead for the ndb_mgmd and ndb_mgm processes. 在具有多个 CPU、核心或两者兼有的主机上运行多个集群数据节点是可以接受的。NDB Cluster 发行版还提供了数据节点二进制文件的多线程版本,旨在用于此类系统。有关更多信息,请参见 第 25.5.3 节,“ndbmtd — NDB Cluster 数据节点守护进程(多线程)”。It is acceptable to run multiple cluster data nodes on a single host that has multiple CPUs, cores, or both. The NDB Cluster distribution also provides a multithreaded version of the data node binary intended for use on such systems. For more information, see Section 25.5.3, “ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)”. 在某些情况下,也可以在同一台机器上同时运行数据节点和 SQL 节点;这种安排的性能取决于多个因素,例如核心和 CPU 数量,以及数据节点和 SQL 节点进程可用的磁盘和内存量,在规划此类配置时必须考虑这些因素。It is also possible in some cases to run data nodes and SQL nodes concurrently on the same machine; how well such an arrangement performs is dependent on a number of factors such as number of cores and CPUs as well as the amount of disk and memory available to the data node and SQL node processes, and you must take these factors into account when planning such a configuration. | |
A.10.24. | 我可以在不重启 NDB Cluster 的情况下添加数据节点吗?Can I add data nodes to an NDB Cluster without restarting it? |
可以在不中断集群运行的情况下向正在运行的 NDB 集群添加新的数据节点。有关更多信息,请参见 第 25.6.7 节,“在线添加 NDB 集群数据节点”。It is possible to add new data nodes to a running NDB Cluster without taking the cluster offline. For more information, see Section 25.6.7, “Adding NDB Cluster Data Nodes Online”. 对于其他类型的 NDB 集群节点,只需要滚动重启即可(参见 第 25.6.5 节,“对 NDB 集群执行滚动重启”)。For other types of NDB Cluster nodes, a rolling restart is all that is required (see Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”). | |
A.10.25. | 使用 NDB 集群时,我需要注意哪些限制?Are there any limitations that I should be aware of when using NDB Cluster? |
MySQL NDB 集群中
有关 NDB Cluster 限制的完整列表,请参见 第 25.2.7 节,“NDB Cluster 已知的限制”。另请参见 NDB Cluster 8.0 中已解决的以前 NDB Cluster 问题。For a complete listing of limitations in NDB Cluster, see Section 25.2.7, “Known Limitations of NDB Cluster”. See also Previous NDB Cluster Issues Resolved in NDB Cluster 8.0. | |
A.10.26. | NDB Cluster 支持外键吗?Does NDB Cluster support foreign keys? |
NDB Cluster 提供对外键约束的支持,其功能可与 | |
A.10.27. | 如何将现有的 MySQL 数据库导入到 NDB Cluster?How do I import an existing MySQL database into an NDB Cluster? |
您可以像使用任何其他版本的 MySQL 一样将数据库导入 NDB 集群。除了本常见问题解答中提到的限制之外,唯一的特殊要求是,任何要包含在集群中的表必须使用 也可以使用一个或多个 | |
A.10.28. | NDB Cluster 节点如何相互通信?How do NDB Cluster nodes communicate with one another? |
集群节点可以通过三种不同的传输机制进行通信:TCP/IP、SHM(共享内存)和 SCI(可扩展一致接口)。在可用情况下,默认情况下在位于同一集群主机上的节点之间使用 SHM;然而,这被认为是实验性的。SCI 是一种高速(每秒 1 千兆及以上)、高可用性的协议,用于构建可扩展多处理器系统;它需要特殊的硬件和驱动程序。有关将 SCI 用作 NDB 集群传输机制的更多信息,请参见第 25.4.4 节,“使用高速互连与 NDB 集群”。Cluster nodes can communicate through any of three different transport mechanisms: TCP/IP, SHM (shared memory), and SCI (Scalable Coherent Interface). Where available, SHM is used by default between nodes residing on the same cluster host; however, this is considered experimental. SCI is a high-speed (1 gigabit per second and higher), high-availability protocol used in building scalable multi-processor systems; it requires special hardware and drivers. See Section 25.4.4, “Using High-Speed Interconnects with NDB Cluster”, for more about using SCI as a transport mechanism for NDB Cluster. | |
A.10.29. | 什么是仲裁器?What is an arbitrator? |
如果集群中的一个或多个数据节点失败,可能并非所有集群数据节点都能够互相“看到””。实际上,在网络分区中,两个数据节点集可能会相互隔离,这种情况也称为“脑裂”场景。这种情况是不理想的,因为每组数据节点都试图表现得好像它是整个集群一样。需要一个仲裁者来在竞争的数据节点集之间做出决定。If one or more data nodes in a cluster fail, it is possible that not all cluster data nodes are able to “see” one another. In fact, it is possible that two sets of data nodes might become isolated from one another in a network partitioning, also known as a “split-brain” scenario. This type of situation is undesirable because each set of data nodes tries to behave as though it is the entire cluster. An arbitrator is required to decide between the competing sets of data nodes. 当至少一个节点组中的所有数据节点都存活时,网络分区不是问题,因为集群的任何单一子集都无法独立形成一个功能性集群。真正的问题出现在没有单个节点组的所有节点都存活的情况下,这时网络分区(即“脑裂”场景)就有可能发生。此时需要一个仲裁者。所有集群节点会将同一个节点识别为仲裁者,通常是管理服务器;但是,也可以将集群中的任何 MySQL 服务器配置为仲裁者。仲裁者接受首先联系它的集群节点组,并告诉其余节点组关闭。仲裁者的选择由 MySQL 服务器和管理服务器节点的 仲裁者的角色本身并不会对被指定的主机施加任何沉重的要求,因此仲裁者主机不需要特别快或为此目的配置额外内存。The role of arbitrator does not in and of itself impose any heavy demands upon the host so designated, and thus the arbitrator host does not need to be particularly fast or to have extra memory especially for this purpose. | |
A.10.30. | NDB 集群支持哪些数据类型?What data types are supported by NDB Cluster? |
NDB 集群支持所有常用的 MySQL 数据类型,包括与 MySQL 空间扩展相关的数据类型;然而, Note NDB 集群磁盘表(即使用 有关这些问题的更多信息,请参见 第 25.2.7 节,“NDB 集群的已知限制”。See Section 25.2.7, “Known Limitations of NDB Cluster”, for more information about these issues. | |
A.10.31. | 我如何启动和停止 NDB 集群?How do I start and stop NDB Cluster? |
有必要按照以下顺序分别启动群集中的每个节点:It is necessary to start each node in the cluster separately, in the following order:
这些命令必须在托管受影响节点的计算机上的系统 shell 中运行。(你不必亲自到计算机前——可以使用远程登录 shell 来执行。)你可以通过在管理节点所在的计算机上启动 要关闭正在运行的集群,在管理客户端中执行 $> (这个示例中的引号是可选的,因为在 这些命令中的任何一个都会导致 ndb_mgm、ndb_mgm 以及任何 ndbd 进程优雅地终止。运行作为 SQL 节点的 MySQL 服务器可以使用 mysqladmin shutdown 来停止。Either of these commands causes the ndb_mgm, ndb_mgm, and any ndbd processes to terminate gracefully. MySQL servers running as SQL nodes can be stopped using mysqladmin shutdown. 有关更多信息,请参见 第 25.6.1 节,“NDB 集群管理客户端中的命令”,以及 第 25.3.6 节,“NDB 集群的安全关闭和重启”。For more information, see Section 25.6.1, “Commands in the NDB Cluster Management Client”, and Section 25.3.6, “Safe Shutdown and Restart of NDB Cluster”. MySQL 集群管理器提供了处理 NDB 集群节点启动和停止的其他方法。有关该工具的更多信息,请参见 MySQL Cluster Manager 8.4.9 用户手册。MySQL Cluster Manager provides additional ways to handle starting ansd stopping of NDB Cluster nodes. See MySQL Cluster Manager 8.4.9 User Manual, for more information about this tool. | |
A.10.32. | 当集群关闭时,NDB 集群数据会发生什么?What happens to NDB Cluster data when the cluster is shut down? |
集群的数据节点中保存在内存中的数据会写入磁盘,并在集群下次启动时重新加载到内存中。The data that was held in memory by the cluster's data nodes is written to disk, and is reloaded into memory the next time that the cluster is started. | |
A.10.33. | 在 NDB 集群中拥有多个管理节点是一个好主意吗?Is it a good idea to have more than one management node for an NDB Cluster? |
这可以作为一种故障保护方案。任意时刻只有一个管理节点控制集群,但可以将一个管理节点配置为主节点,将一个或多个附加管理节点配置为在主管理节点发生故障时接管。It can be helpful as a fail-safe. Only one management node controls the cluster at any given time, but it is possible to configure one management node as primary, and one or more additional management nodes to take over in the event that the primary management node fails. 有关如何配置 NDB 集群管理节点的信息,请参见 第 25.4.3 节,“NDB 集群配置文件”。See Section 25.4.3, “NDB Cluster Configuration Files”, for information on how to configure NDB Cluster management nodes. | |
A.10.34. | 我可以在一个 NDB 集群中混合使用不同类型的硬件和操作系统吗?Can I mix different kinds of hardware and operating systems in one NDB Cluster? |
是的,只要所有机器和操作系统具有相同的 “字节序”(全部为大端或全部为小端)。Yes, as long as all machines and operating systems have the same “endianness” (all big-endian or all little-endian). 也可以在不同节点上使用来自不同 NDB Cluster 版本的软件下载。然而,我们仅在滚动升级程序的一部分中支持这种使用(参见第 25.6.5 节,“执行 NDB Cluster 的滚动重启”)。It is also possible to use software from different NDB Cluster releases on different nodes. However, we support such use only as part of a rolling upgrade procedure (see Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”). | |
A.10.35. | 我可以在单个主机上运行两个数据节点吗?两个 SQL 节点呢?Can I run two data nodes on a single host? Two SQL nodes? |
是的,这是可行的。在有多个数据节点的情况下,建议(但不是必须)每个节点使用不同的数据目录。如果您想在一台机器上运行多个 SQL 节点,每个 mysqld 实例必须使用不同的 TCP/IP 端口。Yes, it is possible to do this. In the case of multiple data nodes, it is advisable (but not required) for each node to use a different data directory. If you want to run multiple SQL nodes on one machine, each instance of mysqld must use a different TCP/IP port. 在同一主机上同时运行数据节点和 SQL 节点是可能的,但您应当注意,ndbd 或 ndbmtd 进程可能会与 mysqld 争夺内存。Running data nodes and SQL nodes together on the same host is possible, but you should be aware that the ndbd or ndbmtd processes may compete for memory with mysqld. | |
A.10.36. | 我可以在 NDB 集群中使用主机名吗?Can I use host names with NDB Cluster? |
是的,可以使用 DNS 和 DHCP 来配置集群主机。不过,如果你的应用需要“五个九”的可用性,你应该使用固定(数字)IP 地址,因为让集群主机之间的通信依赖于诸如 DNS 和 DHCP 之类的服务会增加潜在的故障点。Yes, it is possible to use DNS and DHCP for cluster hosts. However, if your application requires “five nines” availability, you should use fixed (numeric) IP addresses, since making communication between Cluster hosts dependent on services such as DNS and DHCP introduces additional potential points of failure. | |
A.10.37. | NDB 集群支持 IPv6 吗?Does NDB Cluster support IPv6? |
所有类型的 NDB 集群节点都支持 IPv6,包括管理节点、数据节点以及 API 或 SQL 节点。All types of NDB Cluster nodes support IPv6; this includes management nodes, data nodes, and API or SQL nodes. | |
A.10.38. | 在拥有多个 MySQL 服务器的 NDB 集群中,我该如何管理 MySQL 用户?How do I handle MySQL users in an NDB Cluster having multiple MySQL servers? |
MySQL 用户账户和权限通常不会在访问相同 NDB 集群的不同 MySQL 服务器之间自动传播。MySQL NDB 集群通过使用 | |
A.10.39. | 如果一个 SQL 节点发生故障,我如何继续发送查询?How do I continue to send queries in the event that one of the SQL nodes fails? |
MySQL NDB 集群不提供 SQL 节点之间的任何自动故障转移功能。您的应用程序必须准备好处理 SQL 节点的丢失并在它们之间进行故障切换。MySQL NDB Cluster does not provide any sort of automatic failover between SQL nodes. Your application must be prepared to handle the loss of SQL nodes and to fail over between them. | |
A.10.40. | 我如何备份和恢复 NDB 集群?How do I back up and restore an NDB Cluster? |
您可以在 NDB 管理客户端中使用 NDB 集群的原生备份和恢复功能,以及 ndb_restore 程序。请参见 第 25.6.8 节,“NDB 集群的在线备份”,以及 第 25.5.23 节,“ndb_restore — 恢复 NDB 集群备份”。You can use the NDB Cluster native backup and restore functionality in the NDB management client and the ndb_restore program. See Section 25.6.8, “Online Backup of NDB Cluster”, and Section 25.5.23, “ndb_restore — Restore an NDB Cluster Backup”. 您还可以使用 mysqldump 和 MySQL 服务器提供的用于此目的的传统功能。有关更多信息,请参见 第 6.5.4 节,“mysqldump — 数据库备份程序”。You can also use the traditional functionality provided for this purpose in mysqldump and the MySQL server. See Section 6.5.4, “mysqldump — A Database Backup Program”, for more information. | |
A.10.41. | 什么是 “angel process”?What is an “angel process”? |
该进程会监控数据节点进程,并在必要时尝试重新启动该进程。如果在启动 ndbd 后检查系统上的活动进程列表,你会看到实际上有两个具有该名称的进程在运行,如下所示(为了简洁,我们省略了来自 ndb_mgmd 和 ndbd 的输出):This process monitors and, if necessary, attempts to restart the data node process. If you check the list of active processes on your system after starting ndbd, you can see that there are actually 2 processes running by that name, as shown here (we omit the output from ndb_mgmd and ndbd for brevity): $> 显示内存和 CPU 使用率均为 |