The logging flexibility of MySQL Cluster is enormous. The following sections cover the commands you can use to log precisely what you want to log and where.
The CLUSTERLOG ON and CLUSTERLOG OFF Commands
The CLUSTERLOG commands enable and disable cluster logging. You can pass a severity level to these command, but we suggest that you use the CLUSTERLOG FILTER command (see the section "The CLUSTERLOG FILTER Command," later in this appendix) to do that.
This command should make it clear that it has worked:
ndb_mgm> CLUSTERLOG ON Cluster logging is enabled
The CLUSTERLOG TOGGLE Command
The CLUSTERLOG TOGGLE command toggles the cluster log (that is, it inverts the current setting, so if it is currently enabled, TOGGLE disables it and vice versa). It also tells you whether cluster logging is enabled or disabled after you have issued the command, as CLUSTERLOG ON and CLUSTERLOG OFF do, as in the following example:
ndb_mgm> CLUSTERLOG TOGGLE; Cluster logging is enabled. ndb_mgm> CLUSTERLOG TOGGLE; Cluster logging is disabled
The CLUSTERLOG INFO Command
The CLUSTERLOG INFO command prints information about the current cluster logging status, telling you what severities (see Table B.1 in the following section) are currently being logged globally:
ndb_mgm> CLUSTERLOG INFO Severities enabled: INFO WARNING ERROR CRITICAL ALERT
The CLUSTERLOG FILTER Command
The CLUSTERLOG FILTER command enables or disables logging of each severity level. If a severity level is turned on, all events with a priority less than or equal to the category thresholds are logged. You set the thresholds for each category individually for each node or globally by using the CLUSTERLOG command, which is covered shortly. If the severity level is turned off, no events belonging to that severity level are logged. This is a global setting (that is, it affects all nodes in the cluster).
The severity levels shown in Table B.1 are used in MySQL Cluster.
Level Number |
Level Name |
Description |
---|---|---|
1 |
ALERT |
A condition that should be corrected immediately, such as a corrupted system database |
2 |
CRITICAL |
Critical conditions, such as device errors or insufficient resources |
3 |
ERROR |
Conditions that should be corrected, such as configuration errors |
4 |
WARNING |
Conditions that are not errors but that might require handling |
5 |
INFO |
Informational messages, which may be useful for troubleshooting before you submit a bug report or a request for help |
6 |
DEBUG |
Debugging messages, which you almost certainly want to ignore |
Calling CLUSTERLOG FILTER simply inverts the current selection, so issuing CLUSTERLOG FILTER ALERT twice when the filter starts off enabled results in disabling and then enabling logging (remember that you can see which severity levels are currently being logged with the command CLUSTERLOG INFO):
ndb_mgm> CLUSTERLOG FILTER ALERT ALERT disabled ndb_mgm> CLUSTERLOG FILTER ALERT ALERT enabled
The CLUSTERLOG =<threshold level> Command
The CLUSTERLOG = command initiates logging of events with priority less than or equal to in the cluster log. Note that this can be set globally (do not specify an field) or for each node individually (specify ). Note that the severity level must be enabled for any logging to take place; if you have disabled filtering for all CRITICAL errors, there will be no messages that belong to the CRITICAL severity level in your log file, regardless of what you set with the CLUSTERLOG command. You can check what severity levels are currently enabled by using the CLUSTERLOG INFO command.
For example, by using this command, you can set a threshold of 7 for STARTUP events, but a threshold of 2 for BACKUP events. In this way, you can log what you want to log as much as you like, while reducing the amount of junk in the log files. You can also set different log levels for each node. This has clear uses; for example, when trying to track down a connection error on one node, you can get an enormous amount of information logged that is all relevant to that particular node's connection errors but not accumulate enormous quantities of irrelevant logging information from other nodes that are functioning fine.
You can use the following categories:
STARTUP (default: 7) SHUTDOWN (default: 7) STATISTICS (default: 7) CHECKPOINT (default: 7) NODERESTART (default: 7) CONNECTION (default: 7) INFO (default: 7) ERROR (default: 15) CONGESTION DEBUG BACKUP
The threshold level is a number between 0 and 15, where 0 is the most important events, and 15 is purely for information and debugging. Each level also includes the lower levels as well. For example, if you specify a threshold of 4, it automatically includes 3, 2, 1, and 0.
For example, to log events with a threshold level (importance) of less than or equal to 5 from connections involving Node 2, you would enter this:
ndb_mgm> 2 CLUSTERLOG CONNECTION=5 Executing CLUSTERLOG CONNECTION=5 on node 2 OK!
Installation
Configuration
Backup and Recovery
Security and Management
Performance
Troubleshooting
Common Setups
A MySQL Cluster Binaries
B Management Commands
C Glossary of Cluster Terminology
Index