以下部分描述了与早期版本系列相比,MySQL NDB Cluster 在 NDB Cluster 8.0 至 8.0.44 中实现的更改。The following sections describe changes in the implementation of MySQL NDB Cluster in NDB Cluster 8.0 through 8.0.44, as compared to earlier release series.
NDB Cluster 8.4 也可用于生产环境;虽然仍支持 NDB 8.0,但我们建议在新部署中使用 NDB 8.4;更多信息,请参见 第 25 章,MySQL NDB Cluster 8.4。NDB Cluster 9.4 作为创新版本提供,用于正在开发的新功能;请参见 NDB Cluster 9.4 的新特性。NDB Cluster 8.4 is also available for production; while NDB 8.0 is still supported, we suggest that you use NDB 8.4 for new deployments; for more information, see Chapter 25, MySQL NDB Cluster 8.4. NDB Cluster 9.4 is available as an Innovation release for new features currently under development; see What is New in NDB Cluster 9.4.
NDB Cluster 7.6(参见 NDB Cluster 7.6 中的新特性)是之前的 GA 版本,目前仍支持在生产环境中使用,尽管我们建议在新的生产部署中使用 MySQL NDB Cluster 8.4。NDB Cluster 7.5、7.4 和 7.3 是之前的 GA 版本,已经达到生命周期结束,不再支持或维护。我们建议在新的生产部署中使用 MySQL NDB Cluster 8.4。NDB Cluster 7.6 (see What is New in NDB Cluster 7.6) is a previous GA release which is still supported in production, although we recommend that new deployments for production use MySQL NDB Cluster 8.4. NDB Cluster 7.5, 7.4, and 7.3 were previous GA releases which have reached their end of life, and are no longer supported or maintained. We recommend that new deployments for production use MySQL NDB Cluster 8.4.
NDB Cluster 8.4 中的新特性What is New in NDB Cluster 8.4
这里列出了 NDB Cluster 8.4 中可能感兴趣的主要变化和新功能:Major changes and new features in NDB Cluster 8.4 which are likely to be of interest are listed here:
ndbinfo transporter_details 表。
transporter_details表提供有关 NDB 集群中使用的各个传输器的信息。它在其他方面类似于ndbinfotransporters表,该表提供汇总形式的此类信息。ndbinfo transporter_details table. Thetransporter_detailstable provides information about individual transporters used in an NDB cluster. It is otherwise similar to thendbinfotransporterstable, which provides such information in aggregate form.与 NDB 8.0 中引入的版本相比,NDB 8.4.0 提供了额外的列。这些新列及每列的简要说明如下:NDB 8.4.0 provides additional columns as compared to the version introduced in NDB 8.0. These new columns, along with brief dscriptions of each, are listed here:
sendbuffer_used_bytes:当前使用此传输器存储待发送信号数据的字节数。sendbuffer_used_bytes: Number of bytes of signal data currently stored pending send using this transporter.sendbuffer_max_used_bytes:使用此传输器发送信号数据时待发送的字节数的历史最大值。当传输器连接时重置。sendbuffer_max_used_bytes: Historical maximum number of bytes of signal data stored pending send using this transporter. Reset when the transporter connects.sendbuffer_alloc_bytes:当前分配的字节数,用于存储此传输器待发送的字节。发送缓冲区的内存在大块中分配,可能使用不均。sendbuffer_alloc_bytes: Number of bytes of send buffer currently allocated to store pending send bytes for this transporter. Send buffer memory is allocated in large blocks which may be sparsely used.sendbuffer_max_alloc_bytes:用于存储此传输器待发送字节的发送缓冲区分配的历史最大字节数。sendbuffer_max_alloc_bytes: Historical maximum number of bytes of send buffer allocated to store pending send bytes for this transporter.
NDB 8.4.1 添加了一个
type列,用于显示传输器的连接类型(TCP或SHM)。NDB 8.4.1 adds atypecolumn, which displays the transport's connection type (TCPorSHM).请参阅第 25.6.15.65 节,“ndbinfo transporter_details 表”,了解更多信息。See Section 25.6.15.65, “The ndbinfo transporter_details Table”, for more information.
NDB 复制:未使用更新的过滤。 以前,当执行二进制日志记录的 SQL 节点使用
log_replica_updates=OFF时,任何在副本 NDB 集群上应用的复制更新都会被发送到执行二进制日志记录的 SQL 节点。这些更新实际上并未被应用或用于其他用途;这会导致不必要的网络流量和资源消耗。NDB Replication: Filtering of unused updates. Previously, when SQL nodes performing binary logging usedlog_replica_updates=OFF, any replicated updates which were applied on a replica NDB cluster were sent on to the SQL nodes performing binary logging. These updates were not actually applied or used for any other purpose; this entailed unnecessary network traffic and consumption of resources.在 NDB 8.4.0 及更高版本中,应用于副本 SQL 节点的更新会在该节点被过滤掉,并且不再发送到任何其他 SQL 节点。不触发任何日志记录的更新也不再由副本发送。In NDB 8.4.0 and later, updates applied on the replica SQL node are filtered out on this node, and are no longer sent onward to any other SQL nodes. Updates that do not trigger any logging are also no longer sent by the replica.
每会话二进制日志事务缓存大小。
NDB8.4.3 新增了ndb_log_cache_size服务器系统变量,可以设置用于写入二进制日志的事务缓存大小。这使得可以使用较大的缓存来记录 NDB 事务,并且(使用binlog_cache_size)为记录其他事务使用较小的缓存,从而更有效地利用资源。Per-session binary log transaction cache sizing.NDB8.4.3 adds thendb_log_cache_sizeserver system variable, which makes it possible to set the size of the transaction cache used for writing the binary log. This enables use of a large cache for logging NDB transactions, and (usingbinlog_cache_size) a smaller cache for logging other transactions, thus making more efficient use of resources.Ndb.cfg 文件弃用。 使用
Ndb.cfg文件来设置 NDB 进程的连接字符串,文档支持不完善。自 NDB 8.4.3 起,该文件的使用已正式弃用;你应预期在未来的 MySQL Cluster 版本中对其支持将被移除。Ndb.cfg file deprecation. Use of anNdb.cfgfile for setting the connection string for an NDB process was not well documented or supported. As of NDB 8.4.3, use of this file is now formally deprecated; you should expect support for it to be removed in a future release of MySQL Cluster.微秒级节点日志时间戳。 在
NDB8.4.6 及更高版本中,节点日志时间戳可以以微秒精度打印。数据节点可以通过数据节点--ndb-log-timestamps=UTC选项启用该功能;管理节点可以通过 ndb_mgmd 选项--ndb-log-timestamps=UTC实现。为保持向后兼容性,默认值是LEGACY,使用系统时区并以秒为单位显示分辨率,与之前的版本相同。Microsecond node log timestamps. Node log timestamps inNDB8.4.6 and later can be printed with microsecond resolution. Data nodes can enable this feature using the data node--ndb-log-timestamps=UTCoption; management nodes can do this using the ndb_mgmd option--ndb-log-timestamps=UTC. For backwards compatible behavior, the default isLEGACY, which uses the system time zone and resolution in seconds, as in previous releases.SQL 节点可以使用大致等效的选项
--log-timestamps;您应注意,此 mysqld 选项不接受LEGACY作为值。SQL nodes can use the roughly equivalent option--log-timestamps; you should be aware that this mysqld option does not acceptLEGACYas a value.有关 NDB Cluster 节点日志的更多信息,请参见 第 25.6.2 节,“NDB Cluster 日志消息”。For more information about NDB Cluster node logs, see Section 25.6.2, “NDB Cluster Log Messages”.
MySQL Cluster Manager 拥有一个高级命令行界面,可以简化许多复杂的 NDB Cluster 管理任务。有关更多信息,请参见 MySQL Cluster Manager 8.4.9 用户手册。MySQL Cluster Manager has an advanced command-line interface that can simplify many complex NDB Cluster management tasks. See MySQL Cluster Manager 8.4.9 User Manual, for more information.
NDB 8.x 创新版本的变化Changes in NDB 8.x Innovation Releases
与 NDB 8.0 相比,NDB 集群创新版本(8.1、8.2、8.3)中的新功能和重大变化列在此处,可能会引起兴趣:New features and major changes in NDB Cluster Innovation releases (8.1, 8.2, 8.3) compared with NDB 8.0 which are likely to be of interest are listed here:
用于集群节点通信的 TLS。 NDB Cluster 8.3 及更高版本提供对通过传输层安全性 (TLS) 和互联网公钥基础设施 (PKI) 认证和加密 NDB 节点之间以及 NDB 管理服务器与其客户端之间连接的网络通信的支持;TLS 应用于 NDB 传输协议和 NDB 管理协议。TLS for cluster node communications. NDB Cluster 8.3 and later provides support for network communications secured by Transport Layer Security (TLS) and Internet Public Key Infrastructure (PKI) to authenticate and encrypt connections between NDB nodes, and between the NDB management server and its clients; TLS is applied to the NDB Transporter Protocol, and to the NDB Management Protocol.
此功能使用 TLS 双向认证,其中节点自身的证书文件包含节点用于验证其对等方证书的信任链。当集群启用 TLS 时,数据节点和管理节点使用 TLS 执行以下任务:This feature uses TLS mutual authentication, in which a node's own certificate file contains the chain of trust which the node uses to validate the certificates of its peers. When TLS is enabled on the cluster, data and management nodes use TLS to perform the following tasks:
在网络层上对
NDB客户端和服务器进行相互认证,防止未授权访问客户端或服务器Mutually authenticateNDBclients and servers at the network level, preventing unprivileged access as a client or server加密数据传输,避免数据被窃听、篡改或中间人攻击Encrypt data transfer, avoiding data eavesdropping, modification, and man-in-the-middle attacks
使用 MySQL 客户端协议的连接采用 MySQL 用户认证,并可能使用 TLS(包括可选的双向 TLS),如本手册其他部分所述;详情请参见 第 8.3 节,“使用加密连接”。Connections that use the MySQL client protocol employ MySQL user authentication, and may use TLS (including optional mutual TLS) as described elsewhere in this Manual; see Section 8.3, “Using Encrypted Connections”, for more information.
NDB实现了一个新工具 ndb_sign_keys,可用于创建和管理 CA、证书文件以及密钥。您可以使用给定的配置文件,通过 ndb_sign_keys--create-key为集群中的所有节点生成一组密钥和证书。NDBimplements a new tool ndb_sign_keys which can be used to create and manage CA, certificate files, and keys. You can generate a set of keys and certificates for all nodes in a cluster with a given configuration file using ndb_sign_keys--create-key.使用 ndb_sign_keys,节点证书可以绑定到特定主机名、设置在指定日期过期,并与特定节点类型关联,从而使客户端与服务器区分开来,管理服务器与数据节点区分开来。(每个 NDB TLS 证书都可以用于 MGM 客户端连接。)私钥会在原地创建,从而将包含私钥的文件复制降到最低。私钥和证书都标记为“活动”或“待定”;ndb_sign_keys 还提供了密钥轮换的帮助,以允许待定密钥在活动密钥过期之前替换活动密钥。Using ndb_sign_keys, a node certificate can be bound to a particular hostname, made to expire on a given date, and be associated with a given node type, so that clients are distinct from servers, and management servers from data nodes. (Every NDB TLS certificate can be used for MGM client connections.) Private keys are created in place, so that copying of files containing private keys is minimized. Both private keys and certificates are labeled as either active or pending; ndb_sign_keys also provides help with rotating keys to allow for pending keys to replace active keys before the active keys expire.
可以使用系统终端通过 ndb_mgm 客户端并带有
--test-tls来测试节点 TLS 连接,或者在 ndb_mgm 客户端中使用TLS INFO命令。您可以通过检查ndbinfocertificates表获取集群节点使用的证书信息。Testing of node TLS connections can be done from the system shell using ndb_mgm client with--test-tls, or within the ndb_mgm client using theTLS INFOcommand. You can obtain information about certificates used by cluster nodes by checking thendbinfocertificatestable.要强制要求使用 TLS,请在每个集群主机的
my.cnf中设置客户端选项ndb-mgm-tls=strict,然后在集群config.ini文件的[mgm default]部分中设置RequireTls=true,并且在配置文件的[ndbd default]部分也设置RequireTls=true。然后执行集群的滚动重启,使用--reload--config-file重启管理服务器。To enforce a requirement for TLS, set the client optionndb-mgm-tls=strictinmy.cnfon each cluster host, then setRequireTls=truein the[mgm default]section of the clusterconfig.inifile, and setRequireTls=truein the[ndbd default]section of the configuration file as well. Then perform a rolling restart of the cluster, restarting the management server with--reload--config-file.在 NDB 8.3 及更高版本中,NDB Cluster API 应用程序也支持使用 TLS 连接。有关 MGM API 支持的信息,请参阅 TLS 函数。NDB API
Ndb_cluster_connection类添加了configure_tls()和get_tls_certificate_path()方法,用于客户端设置 TLS 连接。Use of TLS connections is also supported in NDB Cluster API applications in NDB 8.3 and later. For information about MGM API support, see TLS Functions. The NDB APINdb_cluster_connectionclass addsconfigure_tls()get_tls_certificate_path()methods for setting up TLS connections by clients.有关更多信息,请参见第 25.6.19.5 节,“NDB 集群的 TLS 链接加密”,以及第 25.5.28 节,“ndb_sign_keys — 为 NDB 集群创建、签名和管理 TLS 密钥和证书”。For more information, see Section 25.6.19.5, “TLS Link Encryption for NDB Cluster”, as well as Section 25.5.28, “ndb_sign_keys — Create, Sign, and Manage TLS Keys and Certificates for NDB Cluster”.
二进制日志注入器内存分配。 在以前版本的 NDB Cluster 中,当
NDB二进制日志注入器处理模式更改并跟踪二进制日志状态时,用于这些目的的内存分配的 arena 选择是通过更改线程本地指针强制执行的,从而试图捕获在 epoch 处理期间执行的所有分配。在 epoch 结束时,这些指针被重置,arena 内存被释放,arena 结构被丢弃;这释放了内存,但也需要为下一个 epoch 再次设置它。线程本地指针的更改还引入了在不同子系统中激活功能时内存分配错误的风险。MySQL NDB Cluster 8.3 对此功能进行了以下改进:Binary log injector memory allocation. In previous versions of NDB Cluster, when theNDBbinary log injector was engaged in handling schema changes and tracking the state of the binary log, the choice of arena for allocation of memory for these purposes was forced by changing thread local pointers, thus attempting to try and catch all allocations performed during epoch processing. At the end of the epoch, those pointers were reset, arena memory was released, and the arena structures discarded; this released the memory, but also required setting it up again for the next epoch. The thread local pointer changes also introduced the risk of memory being allocated wrongly when activating functionality in different subsystems. MySQL NDB Cluster 8.3 makes the following improvements to this functionality:对线程局部指针的更改已被移除,取而代之的是显式参数,用于提供在纪元期间进行分配所使用的 arena。Changes to thread local pointers are removed, and replaced by explicit arguments to provide the arena used for allocation during the epoch.
在下一个纪元中重新使用该 arena,从而避免重复设置。Re-use of the arena for next epoch, thus avoiding the need to set it up repeatedly.
这些更改仅限内部使用,但通过节省内存释放和连续纪元的重新分配,应该会带来显著的改进。These changes are internal only but should provide a noticeable improvememnt by saving on memory release and re-allocation over successive epochs.
NDB API 主键更新。 以前,当尝试使用除
NdbRecord之外的任何其他机制更新主键值时,NDB API 会返回错误 4202 不允许在元组键属性上设置值,即使设置的值与现有值相同。在 NDB 8.1 及更高版本中,执行其他方式的更新时的检查交由数据节点处理,就像使用NdbRecord执行更新时一样。NDB API primary key updates. Previously, when using any other mechanism thanNdbRecordin an attempt to update a primary key value, the NDB API returned error 4202 Set value on tuple key attribute is not allowed, even setting a value identical to the existing one. In NDB 8.1 and later, checking when performing updates by other means is handed off to the data nodes, as it was already when usingNdbRecordto perform the update.这意味着您现在可以使用
NdbOperation::setValue()、NdbInterpretedCode::write_attr()以及其他设置列值的NdbOperation和NdbInterpretedCode方法来执行主键更新(包括NdbOperation方法incValue()、subValue(),以及NdbInterpretedCode方法add_val()、sub_val()等等)。这同样适用于NdbOperation接口的OperationOptions::OO_SETVALUE扩展功能。This means that you can now perform primary key updates usingNdbOperation::setValue(),NdbInterpretedCode::write_attr(), and other methods ofNdbOperationandNdbInterpretedCodewhich set column values (including theNdbOperationmethodsincValue(),subValue(), theNdbInterpretedCodemethodsadd_val(),sub_val(), and so on). This also applies to theNdbOperationinterface'sOperationOptions::OO_SETVALUEextension.改进的警告。 对警告输出进行了以下改进:Improved warnings. Made the following improvements in warning output:
除了本地检查点 (LCP) 已用时间外,现在还会打印允许的最大无进展时间。The maximum time allowed without any progress is now also printed in addition to local checkpoint (LCP) elapsed time.
当 LCP 达到
WAIT_END_LCP状态时,表 ID 和片段 ID 未定义,因此不再相关;因此,我们不再尝试在此时打印它们。When an LCP reachesWAIT_END_LCPstate, table IDs and fragment IDs are undefined and so no longer relevant; for this reason, we no longer attempt to print them at that point.删除在达到最大限制时打印的重复信息(相同信息既作为警告又作为崩溃信息显示)。Removed duplicated information printed when the maximum limit was reached (the same information was shown as both warning and crash information).
此外,当
log_error_verbosity大于或等于 3(INFO 级别)时,我们不再每隔ndb_metadata_check_interval(默认 60)秒将消息 Validating excluded objects 打印到 SQL 节点的错误日志,因为此类消息往往会淹没错误日志,使其难以检查,并占用过多磁盘空间,同时对用户没有任何额外的好处。In addition, we no longer print the message Validating excluded objects to the SQL node's error log everyndb_metadata_check_interval(default 60) seconds whenlog_error_verbosityis greater than or equal to 3 (INFO level), due ot the fact that such messages tended to flood the error log, making it difficult to examine, and using excess disk space, while not providing any additional benefit to the user.现在,对具有非常大且可能重叠的
IN()和NOT IN()列表的查询之间的下推连接进行处理,方式既正确又安全。Pushdown joins between queries featuring very large and possibly overlappingIN()andNOT IN()lists are now handled in a correct and safe manner.ndbcluster插件日志消息现在使用SYSTEM作为日志级别,并使用NDB作为日志子系统。这意味着ndbcluster插件的信息性消息总是会打印;可以通过使用--ndb_extra_logging来控制其详细程度。ndbclusterplugin log messages now useSYSTEMas the log level andNDBas the subsystem for logging. This means that informational messages from thendbclusterplugin are always printed; their verbosity can be controlled by using--ndb_extra_logging.