21.4.30 ndb_top —查看 NDB 线程的 CPU 使用率信息
ndb_top在终端中显示有关 NDB 群集数据节点上 NDB 线程使用 CPU 的运行信息。每个线程在输出中由两行 table 示,第一行显示系统统计信息,第二行显示该线程的测量统计信息。
从 MySQL NDB Cluster 7.6.3 开始,ndb_top可用。
Usage
ndb_top [-h hostname] [-t port] [-u user] [-p pass] [-n node_id]
ndb_top连接到作为群集的 SQL 节点运行的 MySQL 服务器。默认情况下,它尝试以未指定密码的 MySQL root
用户身份连接到在localhost
和端口 3306 上运行的mysqld。您可以分别使用--host(-h
)和--port(-t
)覆盖默认主机和端口。要指定 MySQL 用户和密码,请使用--user(-u
)和--passwd(-p
)选项。该用户必须能够读取ndbinfo数据库中的 table(ndb_top使用ndbinfo.cpustat和相关 table 中的信息)。
有关 MySQL 用户帐户和密码的更多信息,请参见第 6.2 节“访问控制和帐户 Management”。
输出可用为纯文本或 ASCII 图。您可以分别使用--text(-x
)和--graph(-g
)选项进行指定。这两种显示模式提供相同的信息。它们可以同时使用。至少必须使用一种显示模式。
默认情况下支持并启用图形的彩色显示(--color或-c
选项)。启用颜色支持后,图形显示将 OS 用户时间显示为蓝色,将 OS 系统时间显示为绿色,并将空闲时间显示为空白。对于测量的负载,蓝色 table 示执行时间,黄色 table 示发送时间,红色 table 示发送缓冲区已满 await 所花费的时间,空白 table 示空闲时间。图形显示中显示的百分比是所有非空闲线程的百分比之和。颜色目前无法配置;您可以使用--skip-color
来代替灰度。
排序的视图(--sort,-r
)基于测得的负载和 OS 报告的负载的最大值。可以使用--measured-load(-m
)和--os-load(-o
)选项启用和禁用这些显示。必须启用这些负载中至少之一的显示。
该程序尝试从具有由--node-id(-n
)选项指定的节点 ID 的数据节点获取统计信息;如果未指定,则为 1.ndb_top无法提供有关其他类型节点的信息。
视图可以根据终端窗口的高度和宽度进行调整。支持的最小宽度为 76 个字符。
一旦启动,ndb_top就会连续运行,直到被迫退出;您可以使用Ctrl-C
退出程序。显示每秒更新一次;要设置其他延迟间隔,请使用--sleep-time(-s
)。
Note
ndb_top在 macOS,Linux 和 Solaris 上可用。 Windows 平台当前不支持它。
下 table 包含特定于 NDB 群集程序ndb_top的所有选项。附加说明如下 table 所示。
table21.263 ndb_top 程序的命令行选项
Format | Description | 添加,不建议使用或删除 |
---|---|---|
--color , | ||
-c | 以彩色显示 ASCII 图;使用--skip-colors 禁用 | 添加:NDB 7.6.3 |
--graph ,-g | 使用图形显示数据;使用--skip-graphs 禁用 | 添加:NDB 7.6.3 |
--help ,-? | 显示程序使用情况信息 | 添加:NDB 7.6.3 |
--host[=name] ,-h | 要连接的 MySQL Server 的主机名或 IP 地址 | 添加:NDB 7.6.3 |
--measured-load ,-m | 按线程显示测量的负载 | 添加:NDB 7.6.3 |
--node-id[=#] ,-n | 具有此节点 ID 的监视节点 | 已添加:NDB 7.6.3 |
--os-load ,-o | 显示由 os 测量的负载 | 添加:NDB 7.6.3 |
--passwd[=password] ,-p | 使用此密码连接(与--password 选项相同) | 添加:NDB 7.6.3 已删除:NDB 7.6.4 |
--password[=password] ,-p | 使用此密码连接 | 添加:NDB 7.6.6 |
--port[=#] ,-t (<= 7.6.5),-P (> = 7.6.6) | 连接到 MySQL 服务器时要使用的端口号 | 添加:NDB 7.6.3 |
--sleep-time[=seconds] ,-s | 显示刷新之间的 await 时间(以秒为单位) | 已添加:NDB 7.6.3 |
--socket ,-S | 用于连接的套接字文件 | 已添加:NDB 7.6.6 |
--sort ,-r | 按用法对线程进行排序;使用--skip-sort 禁用 | 添加:NDB 7.6.3 |
--text ,-x (<= 7.6.5),-t (> = 7.6.6) | 使用文本显示数据 | 添加:NDB 7.6.3 |
--user[=name] ,-u | 以该 MySQL 用户身份连接 | 添加:NDB 7.6.3 |
在 NDB 7.6.6 和更高版本中,ndb_top还支持通用的NDB
程序选项--defaults-file,--defaults-extra-file,--print-defaults,--no-defaults和--defaults-group-suffix。 (缺陷#86614,错误#26236298)
Additional Options
Property | Value |
---|---|
Command-Line Format | --color |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | TRUE |
以彩色显示 ASCII 图;使用--skip-colors
禁用。
Property | Value |
---|---|
Command-Line Format | --graph |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | TRUE |
使用图 table 显示数据;使用--skip-graphs
禁用。此选项或--text必须为 true;这两个选项可能都是正确的。
Property | Value |
---|---|
Command-Line Format | --help |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | TRUE |
显示程序使用情况信息。
Property | Value |
---|---|
Command-Line Format | --host[=name] |
Introduced | 5.7.19-ndb-7.6.3 |
Type | String |
Default Value | localhost |
要连接的 MySQL 服务器的主机名或 IP 地址。
Property | Value |
---|---|
Command-Line Format | --measured-load |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | FALSE |
按螺纹显示测得的载荷。此选项或--os-load必须为 true;这两个选项可能都是正确的。
Property | Value |
---|---|
Command-Line Format | --node-id[=#] |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Integer |
Default Value | 1 |
观看具有此节点 ID 的数据节点。
Property | Value |
---|---|
Command-Line Format | --os-load |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | TRUE |
显示由 os 测量的负载。此选项或--measured-load必须为 true;这两个选项可能都是正确的。
Property | Value |
---|---|
Command-Line Format | --passwd[=password] |
Introduced | 5.7.19-ndb-7.6.3 |
Removed | 5.7.20-ndb-7.6.4 |
Type | Boolean |
Default Value | NULL |
使用此密码进行连接。
NDB 7.6.4 中不推荐使用此选项。在 NDB 7.6.6 中将其删除,并在其中替换为--password选项。 (缺陷#26907833)
Property | Value |
---|---|
Command-Line Format | --password[=password] |
Introduced | 5.7.22-ndb-7.6.6 |
Type | Boolean |
Default Value | NULL |
使用此密码进行连接。
NDB 7.6.6 中添加了此选项,以代替以前使用的--passwd选项。 (缺陷#26907833)
Property | Value |
---|---|
Command-Line Format | --port[=#] |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Integer |
Default Value | 3306 |
连接到 MySQL 服务器时使用的端口号。
从 NDB 7.6.6 开始,此选项的缩写形式是-P
,并且-t
被重新用作--text选项的缩写形式。 (缺陷#26907833)
Property | Value |
---|---|
Command-Line Format | --sleep-time[=seconds] |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Integer |
Default Value | 1 |
显示刷新之间的 await 时间(以秒为单位)。
Property | Value |
---|---|
Command-Line Format | --socket |
Introduced | 5.7.22-ndb-7.6.6 |
Type | Path name |
Default Value | [none] |
使用指定的套接字文件进行连接。
在 NDB 7.6.6 中添加。 (缺陷#86614,错误#26236298)
Property | Value |
---|---|
Command-Line Format | --sort |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | TRUE |
按用途对线程进行排序;使用--skip-sort
禁用。
Property | Value |
---|---|
Command-Line Format | --text |
Introduced | 5.7.19-ndb-7.6.3 |
Type | Boolean |
Default Value | FALSE |
使用文本显示数据。此选项或--graph必须为 true;这两个选项可能都是正确的。
从 NDB 7.6.6 开始,此选项的简称为-t
,并且删除了对-x
的支持。 (缺陷#26907833)
Property | Value |
---|---|
Command-Line Format | --user[=name] |
Introduced | 5.7.19-ndb-7.6.3 |
Type | String |
Default Value | root |
以该 MySQL 用户身份连接。
示例输出. 下图显示ndb_top在 Linux 系统上的终端窗口中运行,其中ndbmtd数据节点处于中等负载下。在这里,已使用ndb_top -n8 -x调用了程序,以提供文本和图形输出:
图 21.38 ndb_top 在终端中运行