- 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 transporter_details 表格
- 25.6.17.66 ndbinfo transporters 表格
ndbinfo
是一個包含 NDB Cluster 特定資訊的資料庫。
此資料庫包含許多表格,每個表格提供關於 NDB Cluster 節點狀態、資源使用和操作的不同類型資料。您可以在接下來的幾個章節中找到關於每個表格的更多詳細資訊。
ndbinfo
包含在 MySQL Server 的 NDB Cluster 支援中;不需要特殊的編譯或組態步驟;這些表格會在 MySQL Server 連接到叢集時建立。您可以使用 SHOW PLUGINS
來驗證給定 MySQL Server 實例中的 ndbinfo
支援是否為作用中;如果 ndbinfo
支援已啟用,您應該會在 Name
欄位中看到包含 ndbinfo
的列,並且在 Status
欄位中看到 ACTIVE
,如下所示(強調文字)
mysql> SHOW PLUGINS;
+----------------------------------+----------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+----------------------------------+----------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | 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 |
+----------------------------------+----------+--------------------+---------+---------+
46 rows in set (0.00 sec)
您也可以藉由檢查 SHOW ENGINES
的輸出中,是否有在 Engine
欄位包含 ndbinfo
且在 Support
欄位包含 YES
的行來達成,如下所示(強調文字)
mysql> SHOW ENGINES\G
*************************** 1. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 3. row ***************************
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: ndbinfo
Support: YES
Comment: MySQL Cluster system information 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: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 9. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 10. row ***************************
Engine: ndbcluster
Support: YES
Comment: Clustered, fault-tolerant tables
Transactions: YES
XA: NO
Savepoints: NO
10 rows in set (0.01 sec)
如果 ndbinfo
支援已啟用,則您可以在 mysql 或其他 MySQL 用戶端中使用 SQL 陳述式存取 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 Cluster,但叢集變為不可用(由於叢集關閉、網路連線遺失等等事件),ndbinfo
及其表格仍然可見,但是嘗試存取任何表格(除了 blocks
或 config_params
之外)會失敗,並顯示 Got error 157 'Connection to NDB failed' from NDBINFO 的錯誤訊息。
除了 blocks
和 config_params
表格之外,我們所謂的 ndbinfo
「表格」實際上是從內部 NDB
表格產生的檢視,通常對 MySQL Server 不可見。您可以透過將 ndbinfo_show_hidden
系統變數設定為 ON
(或 1
)來使這些表格可見,但通常不需要這樣做。
所有 ndbinfo
表格都是唯讀的,並且在查詢時按需產生。由於它們中的許多表格是由資料節點平行產生,而其他的則是特定於給定 SQL 節點的,因此它們不保證提供一致的快照。
此外,在 ndbinfo
表格上不支援下推聯結;因此,即使查詢使用了 WHERE
子句,聯結大型 ndbinfo
表格也可能需要將大量資料傳輸到請求的 API 節點。
ndbinfo
表格不包含在查詢快取中。(錯誤 #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
儲存引擎;但是,ndbinfo
條目仍然會如先前所述出現在 SHOW ENGINES
和 SHOW PLUGINS
的輸出中。
您可以針對這些表格執行 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)
更複雜的查詢是可能的,例如以下兩個使用 memoryusage
表格的 SELECT
陳述式
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 節,「NDB Cluster 的 INFORMATION_SCHEMA 表格」。