Rechercher dans le manuel MySQL
22.5.9 Quick Reference: NDB Cluster SQL Statements
This section discusses several SQL statements that can prove useful in managing and monitoring a MySQL server that is connected to an NDB Cluster, and in some cases provide information about the cluster itself.
SHOW ENGINE NDB STATUS
,SHOW ENGINE NDBCLUSTER STATUS
The output of this statement contains information about the server's connection to the cluster, creation and usage of NDB Cluster objects, and binary logging for NDB Cluster replication.
See Section 13.7.6.15, “SHOW ENGINE Syntax”, for a usage example and more detailed information.
This statement can be used to determine whether or not clustering support is enabled in the MySQL server, and if so, whether it is active.
See Section 13.7.6.16, “SHOW ENGINES Syntax”, for more detailed information.
NoteThis statement does not support a
LIKE
clause. However, you can useLIKE
to filter queries against theINFORMATION_SCHEMA.ENGINES
table, as discussed in the next item.SELECT * FROM INFORMATION_SCHEMA.ENGINES [WHERE ENGINE LIKE 'NDB%']
This is the equivalent of
SHOW ENGINES
, but uses theENGINES
table of theINFORMATION_SCHEMA
database. Unlike the case with theSHOW ENGINES
statement, it is possible to filter the results using aLIKE
clause, and to select specific columns to obtain information that may be of use in scripts. For example, the following query shows whether the server was built withNDB
support and, if so, whether it is enabled:- +---------+
- | support |
- +---------+
- | ENABLED |
- +---------+
See Section 25.9, “The INFORMATION_SCHEMA ENGINES Table”, for more information.
This statement provides a list of most server system variables relating to the
NDB
storage engine, and their values, as shown here:- +-------------------------------------+-------+
- +-------------------------------------+-------+
- | ndb_autoincrement_prefetch_sz | 32 |
- | ndb_cache_check_time | 0 |
- | ndb_extra_logging | 0 |
- | ndb_index_stat_cache_entries | 32 |
- | ndb_index_stat_enable | OFF |
- | ndb_index_stat_update_freq | 20 |
- | ndb_report_thresh_binlog_epoch_slip | 3 |
- | ndb_report_thresh_binlog_mem_usage | 10 |
- | ndb_use_copying_alter_table | OFF |
- +-------------------------------------+-------+
See Section 5.1.8, “Server System Variables”, for more information.
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'NDB%';
This statement is the equivalent of the
SHOW
command described in the previous item, and provides almost identical output, as shown here:- +-------------------------------------+----------------+
- | VARIABLE_NAME | VARIABLE_VALUE |
- +-------------------------------------+----------------+
- | NDB_AUTOINCREMENT_PREFETCH_SZ | 32 |
- | NDB_CACHE_CHECK_TIME | 0 |
- | NDB_EXTRA_LOGGING | 0 |
- | NDB_INDEX_STAT_CACHE_ENTRIES | 32 |
- | NDB_INDEX_STAT_ENABLE | OFF |
- | NDB_INDEX_STAT_UPDATE_FREQ | 20 |
- | NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP | 3 |
- | NDB_REPORT_THRESH_BINLOG_MEM_USAGE | 10 |
- | NDB_USE_COPYING_ALTER_TABLE | OFF |
- +-------------------------------------+----------------+
Unlike the case with the
SHOW
command, it is possible to select individual columns. For example:See The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables, and Section 5.1.8, “Server System Variables”, for more information.
This statement shows at a glance whether or not the MySQL server is acting as a cluster SQL node, and if so, it provides the MySQL server's cluster node ID, the host name and port for the cluster management server to which it is connected, and the number of data nodes in the cluster, as shown here:
- +--------------------------+----------------+
- +--------------------------+----------------+
- | Ndb_cluster_node_id | 10 |
- | Ndb_config_from_host | 198.51.100.103 |
- | Ndb_config_from_port | 1186 |
- | Ndb_number_of_data_nodes | 4 |
- +--------------------------+----------------+
If the MySQL server was built with clustering support, but it is not connected to a cluster, all rows in the output of this statement contain a zero or an empty string:
- +--------------------------+-------+
- +--------------------------+-------+
- | Ndb_cluster_node_id | 0 |
- | Ndb_config_from_host | |
- | Ndb_config_from_port | 0 |
- | Ndb_number_of_data_nodes | 0 |
- +--------------------------+-------+
See also Section 13.7.6.35, “SHOW STATUS Syntax”.
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'NDB%';
This statement provides similar output to the
SHOW
command discussed in the previous item. However, unlike the case withSHOW STATUS
, it is possible using theSELECT
to extract values in SQL for use in scripts for monitoring and automation purposes.See The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables, for more information.
You can also query the tables in the
ndbinfo
information database for
real-time data about many NDB Cluster operations. See
Section 22.5.10, “ndbinfo: The NDB Cluster Information Database”.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-mysql-cluster-sql-statements.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.