ndbmtd 是 ndbd 的多线程版本,该进程用于处理使用 NDBCLUSTER 存储引擎的表中的所有数据。ndbmtd 旨在用于具有多个 CPU 核心的主机计算机。除非另有说明,ndbmtd 的功能与 ndbd 相同;因此,在本节中,我们重点介绍 ndbmtd 与 ndbd 的不同之处,你应该参考 第 25.5.1 节,“ndbd — NDB 集群数据节点守护进程”,以获取有关运行适用于单线程和多线程版本数据节点进程的 NDB 集群数据节点的更多信息。ndbmtd is a multithreaded version of
ndbd, the process that is used to handle all
the data in tables using the
NDBCLUSTER storage engine.
ndbmtd is intended for use on host computers
having multiple CPU cores. Except where otherwise noted,
ndbmtd functions in the same way as
ndbd; therefore, in this section, we
concentrate on the ways in which ndbmtd
differs from ndbd, and you should consult
Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”, for additional
information about running NDB Cluster data nodes that apply to
both the single-threaded and multithreaded versions of the data
node process.
与 ndbd 一起使用的命令行选项和配置参数同样适用于 ndbmtd。有关这些选项和参数的更多信息,请参见 第 25.5.1 节,“ndbd — NDB 群集数据节点守护进程”,以及 第 25.4.3.6 节,“定义 NDB 群集数据节点”。Command-line options and configuration parameters used with ndbd also apply to ndbmtd. For more information about these options and parameters, see Section 25.5.1, “ndbd — The NDB Cluster Data Node Daemon”, and Section 25.4.3.6, “Defining NDB Cluster Data Nodes”, respectively.
ndbmtd也与文件系统兼容ndbd。换句话说,ndbd可以被停止,二进制文件替换,ndbmtd然后重启,且不会丢失数据。(但在此操作时,如果你MaxNoOfExecutionThreads合适的值再重启节点ndbmtd。)类似地,ndbmtd进制也可以通过ndbd停止节点然后开始ndbd多线程二进制来简单地替换。在两者之间切换时,无需使用“--initial.ndbmtd is also file system-compatible with
ndbd. In other words, a data node running
ndbd can be stopped, the binary replaced with
ndbmtd, and then restarted without any loss
of data. (However, when doing this, you must make sure that
MaxNoOfExecutionThreads
is set to an appropriate value before restarting the node if you
wish for ndbmtd to run in multithreaded
fashion.) Similarly, an ndbmtd binary can be
replaced with ndbd simply by stopping the
node and then starting ndbd in place of the
multithreaded binary. It is not necessary when switching between
the two to start the data node binary using
--initial.
使用 ndbmtd 与使用 ndbd 有两个主要区别:Using ndbmtd differs from using ndbd in two key respects:
因为 ndbmtd 默认以单线程模式运行(也就是说,它的行为类似于 ndbd),因此必须配置它以使用多线程。这可以通过在
config.ini文件中为MaxNoOfExecutionThreads配置参数或ThreadConfig配置参数设置适当的值来实现。使用MaxNoOfExecutionThreads更简单,但ThreadConfig提供了更大的灵活性。有关这些配置参数及其使用的更多信息,请参见 多线程配置参数(ndbmtd)。Because ndbmtd runs by default in single-threaded mode (that is, it behaves like ndbd), you must configure it to use multiple threads. This can be done by setting an appropriate value in theconfig.inifile for theMaxNoOfExecutionThreadsconfiguration parameter or theThreadConfigconfiguration parameter. UsingMaxNoOfExecutionThreadsis simpler, butThreadConfigoffers more flexibility. For more information about these configuration parameters and their use, see Multi-Threading Configuration Parameters (ndbmtd).跟踪文件是由ndbmtd进程中的严重错误生成的,其方式与ndbd故障生成的方式略有不同。这些差异将在接下来的几段中更详细地讨论。Trace files are generated by critical errors in ndbmtd processes in a somewhat different fashion from how these are generated by ndbd failures. These differences are discussed in more detail in the next few paragraphs.
像 ndbd 一样,ndbmtd 会生成一组日志文件,这些文件放置在 config.ini 配置文件中由 DataDir 指定的目录中。除了跟踪文件之外,这些文件的生成方式和名称与 ndbd 生成的文件相同。Like ndbd, ndbmtd
generates a set of log files which are placed in the directory
specified by DataDir in
the config.ini configuration file. Except
for trace files, these are generated in the same way and have
the same names as those generated by ndbd.
在发生严重错误的情况下,ndbmtd 会生成描述错误发生前情况的跟踪文件。这些文件可以在数据节点的 DataDir 中找到,对于 NDB 集群开发和支持团队分析问题非常有用。每个 ndbmtd 线程都会生成一个跟踪文件。这些文件的名称模式如下:In the event of a critical error, ndbmtd
generates trace files describing what happened just prior to the
error' occurrence. These files, which can be found in the
data node's
DataDir, are useful for
analysis of problems by the NDB Cluster Development and Support
teams. One trace file is generated for each
ndbmtd thread. The names of these files have
the following pattern:
ndb_node_id_trace.log.trace_id_tthread_id,
在此模式中,node_id 代表集群中数据节点的唯一节点 ID,trace_id 是跟踪序列号,thread_id 是线程 ID。例如,当作为 NDB 集群数据节点运行、节点 ID 为 3 且 MaxNoOfExecutionThreads 等于 4 的 ndbmtd 进程发生故障时,在数据节点的数据目录中会生成四个跟踪文件。如果这是该节点第一次发生故障,则这些文件命名为 ndb_3_trace.log.1_t1、ndb_3_trace.log.1_t2、ndb_3_trace.log.1_t3 和 ndb_3_trace.log.1_t4。在内部,这些跟踪文件遵循与 ndbd 跟踪文件相同的格式。In this pattern, node_id stands for
the data node's unique node ID in the cluster,
trace_id is a trace sequence number,
and thread_id is the thread ID. For
example, in the event of the failure of an
ndbmtd process running as an NDB Cluster data
node having the node ID 3 and with
MaxNoOfExecutionThreads
equal to 4, four trace files are generated in the data
node's data directory. If the is the first time this node
has failed, then these files are named
ndb_3_trace.log.1_t1,
ndb_3_trace.log.1_t2,
ndb_3_trace.log.1_t3, and
ndb_3_trace.log.1_t4. Internally, these
trace files follow the same format as ndbd
trace files.
ndbd 在数据节点进程意外关闭时生成的退出代码和消息也适用于 ndbmtd。请参见 数据节点错误消息,了解这些消息的完整列表。The ndbd exit codes and messages that are generated when a data node process shuts down prematurely are also used by ndbmtd. See Data Node Error Messages, for a listing of these.
可以在同一个 NDB 集群的不同数据节点上同时使用 ndbd 和 ndbmtd。然而,这种配置尚未经过充分测试;因此,目前我们不建议在生产环境中这样做。It is possible to use ndbd and ndbmtd concurrently on different data nodes in the same NDB Cluster. However, such configurations have not been tested extensively; thus, we cannot recommend doing so in a production setting at this time.