Documentation Home
MySQL 8.3 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 294.0Kb
Man Pages (Zip) - 409.0Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb
Excerpts from this Manual

MySQL 8.3 Reference Manual  /  ...  /  ndbinfo: The NDB Cluster Information Database

25.6.17 ndbinfo:NDB 集群信息数据库

Here is the translated HTML fragment:
25.6.17.1 ndbinfo arbitrator_validity_detail 表
25.6.17.2 ndbinfo arbitrator_validity_summary 表
25.6.17.3 ndbinfo backup_id 表
25.6.17.4 ndbinfo blobs 表
25.6.17.5 ndbinfo blocks 表
25.6.17.6 ndbinfo certificates 表
25.6.17.7 ndbinfo cluster_locks 表
25.6.17.8 ndbinfo cluster_operations 表
25.6.17.9 ndbinfo cluster_transactions 表
25.6.17.10 ndbinfo config_nodes 表
25.6.17.11 ndbinfo config_params 表
25.6.17.12 ndbinfo config_values 表
25.6.17.13 ndbinfo counters 表
25.6.17.14 ndbinfo cpudata 表
25.6.17.15 ndbinfo cpudata_1sec 表
25.6.17.16 ndbinfo cpudata_20sec 表
25.6.17.17 ndbinfo cpudata_50ms 表
25.6.17.18 ndbinfo cpuinfo 表
25.6.17.19 ndbinfo cpustat 表
25.6.17.20 ndbinfo cpustat_50ms 表
25.6.17.21 ndbinfo cpustat_1sec 表
25.6.17.22 ndbinfo cpustat_20sec 表
25.6.17.23 ndbinfo dictionary_columns 表
25.6.17.24 ndbinfo dictionary_tables 表
25.6.17.25 ndbinfo dict_obj_info 表
25.6.17.26 ndbinfo dict_obj_tree 表
25.6.17.27 ndbinfo dict_obj_types 表
25.6.17.28 ndbinfo disk_write_speed_base 表
25.6.17.29 ndbinfo disk_write_speed_aggregate 表
25.6.17.30 ndbinfo disk_write_speed_aggregate_node 表
25.6.17.31 ndbinfo diskpagebuffer 表
25.6.17.32 ndbinfo diskstat 表
25.6.17.33 ndbinfo diskstats_1sec 表
25.6.17.34 ndbinfo error_messages 表
25.6.17.35 ndbinfo events 表
25.6.17.36 ndbinfo files 表
25.6.17.37 ndbinfo foreign_keys 表
25.6.17.38 ndbinfo hash_maps 表
25.6.17.39 ndbinfo hwinfo 表
25.6.17.40 ndbinfo index_columns 表
25.6.17.41 ndbinfo index_stats 表
25.6.17.42 ndbinfo locks_per_fragment 表
25.6.17.43 ndbinfo logbuffers 表
25.6.17.44 ndbinfo logspaces 表
25.6.17.45 ndbinfo membership 表
25.6.17.46 ndbinfo memoryusage 表
25.6.17.47 ndbinfo memory_per_fragment 表
25.6.17.48 ndbinfo nodes 表
25.6.17.49 ndbinfo operations_per_fragment 表
25.6.17.50 ndbinfo pgman_time_track_stats 表
25.6.17.51 ndbinfo processes 表
25.6.17.52 ndbinfo resources 表
25.6.17.53 ndbinfo restart_info 表
25.6.17.54 ndbinfo server_locks 表
25.6.17.55 ndbinfo server_operations 表
25.6.17.56 ndbinfo server_transactions 表
25.6.17.57 ndbinfo table_distribution_status 表
25.6.17.58 ndbinfo table_fragments 表
25.6.17.59 ndbinfo table_info 表
25.6.17.60 ndbinfo table_replicas 表
25.6.17.61 ndbinfo tc_time_track_stats 表
25.6.17.62 ndbinfo threadblocks 表
25.6.17.63 ndbinfo threads 表
25.6.17.64 ndbinfo threadstat 表
25.6.17.65 ndbinfo transporters 表

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

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

ndbinfo 随 NDB 集群支持一起包含在 MySQL 服务器中;不需要特殊的编译或配置步骤;表格是在 MySQL 服务器连接到集群时创建的。你可以使用 SHOW PLUGINS 来验证 ndbinfo 支持是否活动在给定的 MySQL 服务器实例中;如果 ndbinfo 支持启用,你应该看到一个包含 ndbinfo 的行在 Name 列中和 ACTIVEStatus 列中,如下所示(强调文本):

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     |
| caching_sha2_password            | ACTIVE | AUTHENTICATION     | NULL    | GPL     |
| sha2_cache_cleaner               | ACTIVE | AUDIT              | NULL    | GPL     |
| daemon_keyring_proxy_plugin      | ACTIVE | DAEMON             | NULL    | GPL     |
| CSV                              | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MEMORY                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| InnoDB                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| INNODB_TRX                       | 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_TABLES                    | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_TABLESTATS                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_INDEXES                   | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_TABLESPACES               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_COLUMNS                   | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_VIRTUAL                   | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CACHED_INDEXES            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SESSION_TEMP_TABLESPACES  | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| MyISAM                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MRG_MYISAM                       | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| PERFORMANCE_SCHEMA               | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| TempTable                        | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ARCHIVE                          | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| BLACKHOLE                        | 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     |
| ngram                            | ACTIVE | FTPARSER           | NULL    | GPL     |
| mysqlx_cache_cleaner             | ACTIVE | AUDIT              | NULL    | GPL     |
| mysqlx                           | ACTIVE | DAEMON             | NULL    | GPL     |
+----------------------------------+--------+--------------------+---------+---------+
47 rows in set (0.00 sec)

你也可以通过检查 SHOW ENGINES 的输出,查找包含 ndbinfo 的行在 Engine 列中和 YESSupport 列中,如下所示(强调文本):

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 支持启用,那么你可以使用 SQL 语句在 mysql 或其他 MySQL 客户端中访问 ndbinfo。例如,你可以在 SHOW DATABASES 的输出中看到 ndbinfo,如下所示(强调文本):

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 集群,但集群变得不可用(由于事件如集群关闭、网络连接中断等),ndbinfo 和其表格仍然可见,但尝试访问任何表格(除了 blocksconfig_params)将失败,显示 Got error 157 'Connection to NDB failed' from NDBINFO

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

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

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

ndbinfo 表格不包括在查询缓存中。(Bug #59831)

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

mysql> USE ndbinfo;
Database changed

mysql> SHOW TABLES;
+---------------------------------+
| Tables_in_ndbinfo               |
+---------------------------------+
| arbitrator_validity_detail      |
| arbitrator_validity_summary     |
| backup_id                       |
| blobs                           |
| blocks                          |
| certificates                    |
| cluster_locks                   |
| cluster_operations              |
| cluster_transactions            |
| config_nodes                    |
| config_params                   |
| config_values                   |
| counters                        |
| cpudata                         |
| cpudata_1sec                    |
| cpudata_20sec                   |
| cpudata_50ms                    |
| cpuinfo                         |
| cpustat                         |
| cpustat_1sec                    |
| cpustat_20sec                   |
| cpustat_50ms                    |
| dict_obj_info                   |
| dict_obj_tree                   |
| dict_obj_types                  |
| dictionary_columns              |
| dictionary_tables               |
| disk_write_speed_aggregate      |
| disk_write_speed_aggregate_node |
| disk_write_speed_base           |
| diskpagebuffer                  |
| diskstat                        |
| diskstats_1sec                  |
| error_messages                  |
| events                          |
| files                           |
| foreign_keys                    |
| hash_maps                       |
| hwinfo                          |
| index_columns                   |
| index_stats                     |
| locks_per_fragment              |
| logbuffers                      |
| logspaces                       |
| membership                      |
| memory_per_fragment             |
| memoryusage                     |
| nodes                           |
| operations_per_fragment         |
| pgman_time_track_stats          |
| 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                      |
| transporter_details             |
| transporters                    |
+---------------------------------+
66 rows in set (0.00 sec)

所有 ndbinfo 表都使用 NDB 存储引擎;然而,在 SHOW ENGINESSHOW PLUGINS 的输出中仍然会出现一个 ndbinfo 条目,如前所述。

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

mysql> SELECT * FROM memoryusage;
+---------+---------------------+--------+------------+------------+-------------+
| node_id | memory_type         | used   | used_pages | total      | total_pages |
+---------+---------------------+--------+------------+------------+-------------+
|       5 | Data memory         | 425984 |         13 | 2147483648 |       65536 |
|       5 | Long message buffer | 393216 |       1536 |   67108864 |      262144 |
|       6 | Data memory         | 425984 |         13 | 2147483648 |       65536 |
|       6 | Long message buffer | 393216 |       1536 |   67108864 |      262144 |
|       7 | Data memory         | 425984 |         13 | 2147483648 |       65536 |
|       7 | Long message buffer | 393216 |       1536 |   67108864 |      262144 |
|       8 | Data memory         | 425984 |         13 | 2147483648 |       65536 |
|       8 | Long message buffer | 393216 |       1536 |   67108864 |      262144 |
+---------+---------------------+--------+------------+------------+-------------+
8 rows in set (0.09 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.09 sec)

mysql> SELECT SUM(used) as 'Long Message Buffer, All Nodes'
     >     FROM memoryusage
     >     WHERE memory_type = 'Long message buffer';
+-------------------------------------+
| Long Message Buffer Used, All Nodes |
+-------------------------------------+
|                             1179648 |
+-------------------------------------+
1 row in set (0.08 sec)

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

mysql> SELECT * FROM nodes;
+---------+--------+---------+-------------+-------------------+
| node_id | uptime | status  | start_phase | config_generation |
+---------+--------+---------+-------------+-------------------+
|       5 |  17707 | STARTED |           0 |                 1 |
|       6 |  17706 | STARTED |           0 |                 1 |
|       7 |  17705 | STARTED |           0 |                 1 |
|       8 |  17704 | STARTED |           0 |                 1 |
+---------+--------+---------+-------------+-------------------+
4 rows in set (0.06 sec)

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

mysqldump 完全忽略 ndbinfo 数据库,并将其排除在任何输出之外。这甚至适用于使用 --databases--all-databases 选项。

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