MySQL Cluster Core Concepts
NDBCLUSTER (also known as NDB) is an in-memory storage engine offering high-availability and data-persistence features.
NDBCLUSTER(也叫做NDB)是一种提供了高可用性和数据持久性特征的内存式存储引擎。
The NDBCLUSTER storage engine can be configured with a range of failover and load-balancing options, but it is easiest to start with the storage engine at the cluster level. MySQL Cluster's NDB storage engine contains a complete set of data, dependent only on other data within the cluster itself.
NDBCLUSTER存储引擎能够配置一系列的故障切换和负载均衡功能,然而它也是在集群级别下最容易入手的存储引擎。MySQL集群的NDB存储引擎包含一套完整的数据集,它仅依赖于在集群本身中的其他数据。
The “Cluster” portion of MySQL Cluster is configured independently of the MySQL servers. In a MySQL Cluster, each part of the cluster is considered to be a node.
MySQL集群的Cluster部分是独立配置在MySQL服务上面的。在MySQL集群中,集群的每个部分都被看做是一个节点(node)。
Note
In many contexts, the term “node” is used to indicate a computer, but when discussing MySQL Cluster it means a process. It is possible to run multiple nodes on a single computer; for a computer on which one or more cluster nodes are being run we use the term cluster host.
注解:
在多数情况下,node这个术语用于表示一台计算机,但是当讨论MySQL集群时,则它意味着是一个进程。在一台单独的PC机上能够运行多个node节点;在PC机上正在运行的一个或多个集群节点,我们通常把他称为集群主机(cluster host)。
There are three types of cluster nodes, and in a minimal MySQL Cluster configuration, there will be at least three nodes, one of each of these types:
集群的节点有三种类型,在最低限度的MySQL集群配置中,每一种类型的节点要有一个,至少要有三个节点:
Management node: The role of this type of node is to manage the other nodes within the MySQL Cluster, performing such functions as providing configuration data, starting and stopping nodes, running backup, and so forth. Because this node type manages the configuration of the other nodes, a node of this type should be started first, before any other node. An MGM node is started with the command ndb_mgmd.
管理节点(Management node):这种节点的任务主要是在MySQL集群中管理其他节点。执行诸如提供配置数据,打开节点,关闭节点,运行备份等等相应功能。由于这种类型的节点管理着其他节点的配置,因此该节点应先于其他节点启动。一个MGM节点是通过ndb_mgmd命令来启动的。
Data node: This type of node stores cluster data. There are as many data nodes as there are replicas, times the number of fragments (see Section 18.1.2, “MySQL Cluster Nodes, Node Groups, Replicas, and Partitions”). For example, with two replicas, each having two fragments, you need four data nodes. One replica is sufficient for data storage, but provides no redundancy; therefore, it is recommended to have 2 (or more) replicas to provide redundancy, and thus high availability. A data node is started with the command ndbd (see Section 18.4.1, “ndbd — The MySQL Cluster Data Node Daemon”) or ndbmtd (see Section 18.4.3, “ndbmtd — The MySQL Cluster Data Node Daemon (Multi-Threaded)”).
MySQL Cluster tables are normally stored completely in memory rather than on disk (this is why we refer to MySQL Cluster as an in-memory database). However, some MySQL Cluster data can be stored on disk; see Section 18.5.12, “MySQL Cluster Disk Data Tables”, for more information.
数据节点(Data node):这种类型的节点用于存储集群数据。很多的数据节点都有它们的副本,是该分段的一倍。例如,每两个分段就有两个副本,你就需要有四个数据节点。对于数据存储,一个副本是足够的,但是它不提供冗余。因此,我们推荐用两个(或更多)副本去提供冗余,从而实现高可用性。一个数据节点是通过ndbd或ndbmtd命令来启动的。
MySQL集群表通常是完整的存储在内存中的,而不是在硬盘上(这就是为什么我们把MySQL集群称为内存式数据库)。然而,有一些MySQL集群数据是可以存储在硬盘上的。
SQL node: This is a node that accesses the cluster data. In the case of MySQL Cluster, an SQL node is a traditional MySQL server that uses the NDBCLUSTER storage engine. An SQL node is a mysqld process started with the --ndbcluster and --ndb-connectstring options, which are explained elsewhere in this chapter, possibly with additional MySQL server options as well.
An SQL node is actually just a specialized type of API node, which designates any application which accesses MySQL Cluster data. Another example of an API node is the ndb_restore utility that is used to restore a cluster backup. It is possible to write such applications using the NDB API. For basic information about the NDB API, see Getting Started with the NDB API.
SQL节点(SQL node):这种节点是用于访问集群数据的。对于MySQL集群来讲,一个SQL节点是一个传统的MySQL服务,它使用NDBCLUSTER存储引擎。一个SQL节点是通过mysqld命令的--ndbcluster和--ndb-connectstring参数来启动的进程,该选项在本章的其他地方会解释到,用其他的MySQL服务选项也可以做到。
一个SQL节点实际上只是API node的一种专用类型,该类型的节点指定了任何可以访问MySQL集群数据的应用程序。API node的另外一个例子是node_restore功能,它能够被用来恢复一个集群备份。用NDB API去写应用程序是有可能做到的,有关于NDB API的基本信息,请见Getting Started with the NDB API.
Important The Memcache API for MySQL Cluster, implemented as the loadable ndbmemcache storage engine for memcached version 1.6 and later, can be used to provide a persistent MySQL Cluster data store, accessed using the memcache protocol. The standard memcached caching engine is included in the MySQL Cluster NDB 7.3 distribution. Each memcached server has direct access to data stored in MySQL Cluster, but is also able to cache data locally and to serve (some) requests from this local cache. For more information, see ndbmemcache—Memcache API for MySQL Cluster. Management clients. These clients connect to the management server and provide commands for starting and stopping nodes gracefully, starting and stopping message tracing (debug versions only), showing node versions and status, starting and stopping backups, and so on. An example of this type of program is the ndb_mgm management client supplied with MySQL Cluster (see Section 18.4.5, “ndb_mgm — The MySQL Cluster Management Client”). Such applications can be written using the MGM API, a C-language API that communicates directly with one or more MySQL Cluster management servers. For more information, see The MGM API.
Cluster log: Keeps a record of all desired reportable events for the cluster as a whole.
Node log: A separate log which is also kept for each inpidual node.
事件日志:MySQL集群通过种类(启动,关机,错误,检查点等等),优先级和严重性的事件产生日志。一个有关完整的报告性事件的监听,可以在Section 18.5.6,“Event Reports Generated in MySQL Cluster”文章中找到。事件日志在这里有两种类型:
l 集群日志:针对于集群,以保存一份期望的可报告性的事件记录作为一个整体。
l 节点日志:一个单独的日志维护着每一个单一的节点。
Note