Documentation Home
MySQL 8.0 参考手册  / 第 23 章 MySQL NDB Cluster 8.0  / 23.6 NDB Cluster的管理  /  21.6.15 ndbinfo:NDB 集群信息数据库

21.6.15 ndbinfo:NDB 集群信息数据库

21.6.15.1 ndbinfo arbitrator_validity_detail 表
21.6.15.2 ndbinfo arbitrator_validity_summary 表
21.6.15.3 ndbinfo 块表
21.6.15.4 ndbinfo cluster_locks 表
21.6.15.5 ndbinfo cluster_operations 表
21.6.15.6 ndbinfo cluster_transactions 表
21.6.15.7 ndbinfo config_nodes 表
21.6.15.8 ndbinfo config_params 表
21.6.15.9 ndbinfo config_values 表
21.6.15.10 ndbinfo 计数器表
21.6.15.11 ndbinfo cpustat 表
21.6.15.12 ndbinfo cpustat_50ms 表
21.6.15.13 ndbinfo cpustat_1sec 表
21.6.15.14 ndbinfo cpustat_20sec 表
21.6.15.15 ndbinfo dict_obj_info 表
21.6.15.16 ndbinfo dict_obj_types 表
21.6.15.17 ndbinfo disk_write_speed_base 表
21.6.15.18 ndbinfo disk_write_speed_aggregate 表
21.6.15.19 ndbinfo disk_write_speed_aggregate_node 表
21.6.15.20 ndbinfo diskpagebuffer 表
21.6.15.21 ndbinfo error_messages 表
21.6.15.22 ndbinfo locks_per_fragment 表
21.6.15.23 ndbinfo 日志缓冲区表
21.6.15.24 ndbinfo 日志空间表
21.6.15.25 ndbinfo 成员表
21.6.15.26 ndbinfo 内存使用表
21.6.15.27 ndbinfo memory_per_fragment 表
21.6.15.28 ndbinfo 节点表
21.6.15.29 ndbinfo operations_per_fragment 表
21.6.15.30 ndbinfo 进程表
21.6.15.31 ndbinfo 资源表
21.6.15.32 ndbinfo restart_info 表
21.6.15.33 ndbinfo server_locks 表
21.6.15.34 ndbinfo server_operations 表
21.6.15.35 ndbinfo server_transactions 表
21.6.15.36 ndbinfo table_distribution_status 表
21.6.15.37 ndbinfo table_fragments 表
21.6.15.38 ndbinfo table_info 表
21.6.15.39 ndbinfo table_replicas 表
21.6.15.40 ndbinfo tc_time_track_stats 表
21.6.15.41 ndbinfo 线程块表
21.6.15.42 ndbinfo 线程表
21.6.15.43 ndbinfo threadstat 表
21.6.15.44 ndbinfo 传输表

ndbinfo是一个包含 NDB Cluster 特定信息的数据库。

该数据库包含许多表,每个表提供有关 NDB Cluster 节点状态、资源使用情况和操作的不同类型的数据。您可以在接下来的几节中找到有关每个表的更多详细信息。

ndbinfo包含在 MySQL 服务器中的 NDB Cluster 支持中;不需要特殊的编译或配置步骤;这些表由 MySQL 服务器在连接到集群时创建。您可以验证 ndbinfo支持在给定的 MySQL 服务器实例中使用SHOW PLUGINS;如果ndbinfo启用了支持,您应该会看到包含ndbinfoName列中和列ACTIVE中的Status行,如下所示(强调文本):

mysql> SHOW PLUGINS;
+----------------------------------+--------+--------------------+---------+---------+
| Name                             | Status | Type               | Library | License |
+----------------------------------+--------+--------------------+---------+---------+
| binlog                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| mysql_native_password            | ACTIVE | AUTHENTICATION     | NULL    | GPL     |
| sha256_password                  | ACTIVE | AUTHENTICATION     | NULL    | GPL     |
| MRG_MYISAM                       | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MEMORY                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| CSV                              | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MyISAM                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| InnoDB                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| INNODB_TRX                       | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCKS                     | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCK_WAITS                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP                       | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP_RESET                 | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM                    | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM_RESET              | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP_PER_INDEX             | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP_PER_INDEX_RESET       | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_PAGE               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_PAGE_LRU           | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_POOL_STATS         | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_TEMP_TABLE_INFO           | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_METRICS                   | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_DEFAULT_STOPWORD       | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_DELETED                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_BEING_DELETED          | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_CONFIG                 | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_INDEX_CACHE            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_FT_INDEX_TABLE            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_TABLES                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_TABLESTATS            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_INDEXES               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_COLUMNS               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_FIELDS                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_FOREIGN               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_FOREIGN_COLS          | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_TABLESPACES           | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_DATAFILES             | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_VIRTUAL               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| PERFORMANCE_SCHEMA               | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ndbCluster                      | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ndbinfo                          | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ndb_transid_mysql_connection_map | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| BLACKHOLE                        | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ARCHIVE                          | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| partition                        | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ngram                            | ACTIVE | FTPARSER           | NULL    | GPL     |
+----------------------------------+--------+--------------------+---------+---------+
46 rows in set (0.00 sec)

您还可以通过检查 SHOW ENGINES包含 ndbinfoEngine列中和列YES中的行的输出来执行此操作Support ,如此处所示(强调文本):

mysql> SHOW ENGINES\G
*************************** 1. row ***************************
      Engine: ndbcluster
     Support: YES
     Comment: Clustered, fault-tolerant tables
Transactions: YES
          XA: NO
  Savepoints: NO
*************************** 2. row ***************************
      Engine: CSV
     Support: YES
     Comment: CSV storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 3. row ***************************
      Engine: InnoDB
     Support: DEFAULT
     Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
          XA: YES
  Savepoints: YES
*************************** 4. row ***************************
      Engine: BLACKHOLE
     Support: YES
     Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 5. row ***************************
      Engine: MyISAM
     Support: YES
     Comment: MyISAM storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 6. row ***************************
      Engine: MRG_MYISAM
     Support: YES
     Comment: Collection of identical MyISAM tables
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 7. row ***************************
      Engine: ARCHIVE
     Support: YES
     Comment: Archive storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 8. row ***************************
      Engine: ndbinfo
     Support: YES
     Comment: NDB Cluster system information storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 9. row ***************************
      Engine: PERFORMANCE_SCHEMA
     Support: YES
     Comment: Performance Schema
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 10. row ***************************
      Engine: MEMORY
     Support: YES
     Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
          XA: NO
  Savepoints: NO
10 rows in set (0.00 sec)

如果ndbinfo启用了支持,那么您可以在mysql或其他 MySQL 客户端ndbinfo中使用 SQL 语句 访问。例如,您可以在 的输出中看到 listed ,如下所示(强调文本): ndbinfoSHOW DATABASES

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| ndbinfo            |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.04 sec)

如果mysqld进程未使用该 --ndbcluster选项启动, ndbinfo则不可用且不显示SHOW DATABASES。如果 mysqld以前连接到 NDB Cluster 但集群变得不可用(由于集群关闭、网络连接丢失等事件), ndbinfo并且其表仍然可见,但尝试访问任何表(除了blocksconfig_params) 失败并从 NDBINFO 得到错误 157 'Connection to NDB failed'

除了表blocksconfig_params表之外,我们所说的ndbinfo 实际上是从 NDB通常对 MySQL 服务器不可见的内部表生成的视图。ndbinfo_show_hidden您可以通过将系统变量设置为ON(或)使这些表可见 1,但这通常不是必需的。

所有ndbinfo表都是只读的,在查询时按需生成。因为它们中的许多是由数据节点并行生成的,而其他的则特定于给定的 SQL 节点,因此不能保证它们提供一致的快照。

此外,表不支持下推连接 ndbinfo;因此连接大型 ndbinfo表可能需要将大量数据传输到请求 API 节点,即使查询使用了WHERE子句也是如此。

ndbinfo表不包含在查询缓存中。(漏洞 #59831)

您可以使用语句选择ndbinfo数据库 USE,然后发出 SHOW TABLES语句以获取表列表,就像任何其他数据库一样,如下所示:

mysql> USE ndbinfo;
Database changed

mysql> SHOW TABLES;
+---------------------------------+
| Tables_in_ndbinfo               |
+---------------------------------+
| arbitrator_validity_detail      |
| arbitrator_validity_summary     |
| blocks                          |
| cluster_locks                   |
| cluster_operations              |
| cluster_transactions            |
| config_nodes                    |
| config_params                   |
| config_values                   |
| counters                        |
| cpustat                         |
| cpustat_1sec                    |
| cpustat_20sec                   |
| cpustat_50ms                    |
| dict_obj_info                   |
| dict_obj_types                  |
| disk_write_speed_aggregate      |
| disk_write_speed_aggregate_node |
| disk_write_speed_base           |
| diskpagebuffer                  |
| error_messages                  |
| locks_per_fragment              |
| logbuffers                      |
| logspaces                       |
| membership                      |
| memory_per_fragment             |
| memoryusage                     |
| nodes                           |
| operations_per_fragment         |
| processes                       |
| resources                       |
| restart_info                    |
| server_locks                    |
| server_operations               |
| server_transactions             |
| table_distribution_status       |
| table_fragments                 |
| table_info                      |
| table_replicas                  |
| tc_time_track_stats             |
| threadblocks                    |
| threads                         |
| threadstat                      |
| transporters                    |
+---------------------------------+
44 rows in set (0.00 sec)

在 NDB 7.5.0(及更高版本)中,所有ndbinfo表都使用NDB存储引擎;但是, 如前所述 ,ndbinfo条目仍会出现在 SHOW ENGINESand 的输出中。SHOW PLUGINS

config_values表是在 NDB 7.5.0 中添加的。

NDB 7.5.2 中添加了 、cpustatcpustat_50mscpustat_1seccpustat_20sec表 。threads

NDB 7.5.3 中添加了 、cluster_lockslocks_per_fragment表 。server_locks

NDB 7.5.4 中添加了 、dict_obj_infotable_distribution_statustable_fragmentstable_info表 。table_replicas

config_nodesprocesses表是在 NDB 7.5.7 中添加的 。

error_messages表是在 NDB 7.6 中添加的。

您可以对这些表执行SELECT语句,就像您通常期望的那样:

mysql> SELECT * FROM memoryusage;
+---------+---------------------+--------+------------+------------+-------------+
| node_id | memory_type         | used   | used_pages | total      | total_pages |
+---------+---------------------+--------+------------+------------+-------------+
|       5 | Data memory         | 753664 |         23 | 1073741824 |       32768 |
|       5 | Index memory        | 163840 |         20 | 1074003968 |      131104 |
|       5 | Long message buffer |   2304 |          9 |   67108864 |      262144 |
|       6 | Data memory         | 753664 |         23 | 1073741824 |       32768 |
|       6 | Index memory        | 163840 |         20 | 1074003968 |      131104 |
|       6 | Long message buffer |   2304 |          9 |   67108864 |      262144 |
+---------+---------------------+--------+------------+------------+-------------+
6 rows in set (0.02 sec)

更复杂的查询,例如以下两个 SELECT使用该 memoryusage表的语句,是可能的:

mysql> SELECT SUM(used) as 'Data Memory Used, All Nodes'
     >     FROM memoryusage
     >     WHERE memory_type = 'Data memory';
+-----------------------------+
| Data Memory Used, All Nodes |
+-----------------------------+
|                        6460 |
+-----------------------------+
1 row in set (0.37 sec)

mysql> SELECT SUM(max) as 'Total IndexMemory Available'
     >     FROM memoryusage
     >     WHERE memory_type = 'Index memory';
+-----------------------------+
| Total IndexMemory Available |
+-----------------------------+
|                       25664 |
+-----------------------------+
1 row in set (0.33 sec)

ndbinfo表名和列名区分大小写(ndbinfo 数据库本身的名称也是如此)。这些标识符是小写的。尝试使用错误的字母大小写会导致错误,如本例所示:

mysql> SELECT * FROM nodes;
+---------+--------+---------+-------------+
| node_id | uptime | status  | start_phase |
+---------+--------+---------+-------------+
|       1 |  13602 | STARTED |           0 |
|       2 |     16 | STARTED |           0 |
+---------+--------+---------+-------------+
2 rows in set (0.04 sec)

mysql> SELECT * FROM Nodes;
ERROR 1146 (42S02): Table 'ndbinfo.Nodes' doesn't exist

mysqldump完全忽略 ndbinfo数据库,并将其从任何输出中排除。即使使用 --databasesor --all-databases选项也是如此。

NDB Cluster 还在 INFORMATION_SCHEMA信息数据库中维护表,包括FILES包含有关用于 NDB Cluster 磁盘数据存储的文件信息的 ndb_transid_mysql_connection_map 表,以及显示事务、事务协调器和 NDB Cluster API 节点之间关系的表。有关更多信息,请参阅表的描述或 第 21.6.16 节,“NDB Cluster 的 INFORMATION_SCHEMA 表”