Chapter 4. MySQL Cluster Options and Variables
Table of Contents
This section provides information about MySQL server options, server and status variables that are specific to MySQL Cluster. For general information on using these, and for other options and variables not specific to MySQL Cluster, see The MySQL Server.
For MySQL Cluster configuration parameters used in the cluster
confiuration file (usually named config.ini),
see Chapter 3, MySQL Cluster Configuration.
The following table provides a list of the command-line options,
server and status variables applicable within
mysqld when it is running as an SQL node in a
MySQL Cluster. For a table showing all
command-line options, server and status variables available for
use with mysqld, see
Server Option and Variable Reference.
Table 4.1. mysqld Command Options for MySQL Cluster
| Name | Cmd-Line | Option file | System Var | Status Var | Var Scope | Dynamic |
|---|---|---|---|---|---|---|
| Handler_discover | Yes | Both | No | |||
| have_ndbcluster | Yes | Global | No | |||
| ndb_autoincrement_prefetch_sz | Yes | Yes | Yes | Both | Yes | |
| ndb-batch-size | Yes | Yes | Yes | Global | No | |
| ndb_cache_check_time | Yes | Yes | Yes | Global | Yes | |
| ndb-cluster-connection-pool | Yes | Yes | Yes | Global | No | |
| Ndb_cluster_node_id | Yes | Both | No | |||
| Ndb_config_from_host | Yes | Both | No | |||
| Ndb_config_from_port | Yes | Both | No | |||
| Ndb_conflict_fn_max | Yes | Global | No | |||
| Ndb_conflict_fn_old | Yes | Global | No | |||
| ndb-connectstring | Yes | Yes | ||||
| ndb_execute_count | Yes | Global | No | |||
| ndb_extra_logging | Yes | Yes | Yes | Global | Yes | |
| ndb_force_send | Yes | Yes | Yes | Both | Yes | |
| ndb_index_stat_cache_entries | Yes | Yes | ||||
| ndb_index_stat_enable | Yes | Yes | ||||
| ndb_index_stat_update_freq | Yes | Yes | ||||
| ndb_log_empty_epochs | Yes | Yes | Yes | Global | Yes | |
| ndb_log_orig | Yes | Global | No | |||
| ndb-log-update-as-write | Yes | Yes | Yes | Global | Yes | |
| ndb_log_updated_only | Yes | Yes | Yes | Global | Yes | |
| ndb-mgmd-host | Yes | Yes | ||||
| ndb-nodeid | Yes | Yes | Yes | Global | No | |
| Ndb_number_of_data_nodes | Yes | Global | No | |||
| ndb_optimization_delay | Yes | Global | Yes | |||
| ndb_optimized_node_selection | Yes | Yes | ||||
| ndb_pruned_scan_count | Yes | Global | No | |||
| ndb_report_thresh_binlog_epoch_slip | Yes | Yes | ||||
| ndb_report_thresh_binlog_mem_usage | Yes | Yes | ||||
| ndb_scan_count | Yes | Global | No | |||
| ndb_table_no_logging | Yes | Session | Yes | |||
| ndb_table_temporary | Yes | Session | Yes | |||
| ndb_use_copying_alter_table | Yes | Both | No | |||
| ndb_use_exact_count | Yes | Both | Yes | |||
| ndb_use_transactions | Yes | Yes | ||||
| ndb_wait_connected | Yes | Yes | Yes | No | ||
| ndbcluster | Yes | Yes | ||||
| skip-ndbcluster | Yes | Yes | ||||
| slave-allow-batching | Yes | Yes | Global | Yes | ||
| - Variable: slave_allow_batching | Yes | Global | Yes |
This section provides descriptions of mysqld server options relating to MySQL Cluster. For information about mysqld options not specific to MySQL Cluster, and for general information about the use of options with mysqld, see Server Command Options.
For information about command-line options used with other MySQL
Cluster processes (ndbd,
ndb_mgmd, and ndb_mgm), see
Section 6.23, “Options Common to MySQL Cluster Programs”. For
information about command-line options used with
NDB utility programs (such as
ndb_desc, ndb_size.pl, and
ndb_show_tables), see
Chapter 6, MySQL Cluster Programs.
Version Introduced 5.1.23-ndb-6.3.8 Command Line Format --ndb-batch-sizeConfig File Format ndb-batch-sizeVariable Name ndb_batch_sizeVariable Scope Global Dynamic Variable No Value Set Type numericDefault 32768Range 0-31536000This sets the size in bytes that is used for NDB transaction batches.
--ndb-cluster-connection-pool=#Version Introduced 5.1.19-ndb-6.2.2 Command Line Format --ndb-cluster-connection-poolConfig File Format ndb-cluster-connection-poolVariable Name Ndb_cluster_connection_poolVariable Scope Global Dynamic Variable No Value Set Type numericDefault 1Range 1-63By setting this option to a value greater than 1 (the default), a mysqld process can use multiple connections to the cluster, effectively mimicking several SQL nodes. Each connection requires its own
[api]or[mysqld]section in the cluster configuration (config.ini) file, and counts against the maximum number of API connections supported by the cluster.For example, suppose that you have 2 cluster host computers, each running an SQL node whose mysqld process was started with
--ndb-cluster-connection-pool=4; this means that the cluster must have 8 API slots available for these connections (instead of 2). All of these connections are set up when the SQL node connects to the cluster, and are allocated to threads in a round-robin fashion.This option is useful only when running mysqld on host machines having multiple CPUs, multiple cores, or both. For best results, the value should be smaller than the total number of cores available on the host machine. Setting it to a value greater than this is likely to degrade performance severely.
Important
Because each SQL node using connection pooling occupies multiple API node slots — each slot having its own node ID in the cluster — you must not use a node ID as part of the cluster connect string when starting any mysqld process that employs connection pooling.
Setting a node ID in the connect string when using the
--ndb-cluster-connection-pooloption causes node ID allocation errors when the SQL node attempts to connect to the cluster.This option was introduced in MySQL Cluster NDB 6.2.2. Beginning with MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB 6.3.13, the value used for this option is available as a global status variable (Bug#35573).
--ndb-connectstring=connect_stringCommand Line Format --ndb-connectstringConfig File Format ndb-connectstringValue Set Type stringWhen using the
NDBCLUSTERstorage engine, this option specifies the management server that distributes cluster configuration data. See Section 3.4.3, “The MySQL Cluster Connectstring”, for syntax.Command Line Format --ndbclusterConfig File Format ndbclusterValue Set Type booleanDefault FALSEThe
NDBCLUSTERstorage engine is necessary for using MySQL Cluster. If a mysqld binary includes support for theNDBCLUSTERstorage engine, the engine is disabled by default. Use the--ndbclusteroption to enable it. Use--skip-ndbclusterto explicitly disable the engine.Version Introduced 5.1.15 Command Line Format --ndb-nodeid=#Config File Format ndb-nodeidVariable Name Ndb_cluster_node_idVariable Scope Global Dynamic Variable No Value Set (>= 5.1.5) Type numericRange 1-255Set this MySQL server's node ID in a MySQL Cluster. This can be used instead of specifying the node ID as part of the connectstring or in the
config.inifile, or allowing the cluster to determine an arbitrary node ID. If you use this option, then--ndb-nodeidmust be specified before--ndb-connectstring. If--ndb-nodeidis used and a node ID is specified in the connectstring, then the MySQL server will not be able to connect to the cluster. In addition, if--nodeidis used, then either a matching node ID must be found in a[mysqld]or[api]section ofconfig.ini, or there must be an “open”[mysqld]or[api]section in the file (that is, a section without anIdparameter specified).Regardless of how the node ID is determined, its is shown as the value of the global status variable
Ndb_cluster_node_idin the output ofSHOW STATUS, and ascluster_node_idin theconnectionrow of the output ofSHOW ENGINE NDBCLUSTER STATUS.For more information about node IDs for MySQL Cluster SQL nodes, see Section 3.4.7, “Defining SQL and Other API Nodes in a MySQL Cluster”.
Command Line Format --skip-ndbclusterConfig File Format skip-ndbclusterDisable the
NDBCLUSTERstorage engine. This is the default for binaries that were built withNDBCLUSTERstorage engine support; the server allocates memory and other resources for this storage engine only if the--ndbclusteroption is given explicitly. See Section 3.3, “Quick Test Setup of MySQL Cluster”, for an example.
This section provides detailed information about MySQL server
system variables that are specific to MySQL Cluster and the
NDB storage engine. For system
variables not specific to MySQL Cluster, see
Server System Variables. For general information
on using system variables, see
Using System Variables.
Variable Name have_ndbclusterVariable Scope Global Dynamic Variable No Value Set Type booleanYESif mysqld supportsNDBCLUSTERtables.DISABLEDif--skip-ndbclusteris used.Command Line Format --multi_range_count=#Config File Format multi_range_countOption Sets Variable Yes, multi_range_countVariable Name multi_range_countVariable Scope Both Dynamic Variable Yes Value Set Type numericDefault 256Range 1-4294967295The maximum number of ranges to send to a table handler at once during range selects. The default value is 256. Sending multiple ranges to a handler at once can improve the performance of certain selects dramatically. This is especially true for the
NDBCLUSTERtable handler, which needs to send the range requests to all nodes. Sending a batch of those requests at once reduces communication costs significantly.This variable is deprecated in MySQL 5.1, and is no longer supported in MySQL 6.0, in which arbitrarily long lists of ranges can be processed.
Command Line Format --ndb_autoincrement_prefetch_szConfig File Format ndb_autoincrement_prefetch_szOption Sets Variable Yes, ndb_autoincrement_prefetch_szVariable Name ndb_autoincrement_prefetch_szVariable Scope Both Dynamic Variable Yes Value Set (<= 5.1.22) Type numericDefault 32Range 1-256Value Set (>= 5.1.23) Type numericDefault 1Range 1-256Determines the probability of gaps in an autoincremented column. Set it to
1to minimize this. Setting it to a high value for optimization — makes inserts faster, but decreases the likelihood that consecutive autoincrement numbers will be used in a batch of inserts. Default value:32. Minimum value:1.Beginning with MySQL Cluster NDB 6.2.10, MySQL Cluster NDB 6.3.7, and MySQL 5.1.23, this variable affects the number of
AUTO_INCREMENTIDs that are fetched between statements only. Within a statement, at least 32 IDs are now obtained at a time. The default value forndb_autoincrement_prefetch_szis now1, to increase the speed of statements inserting single rows. (Bug#31956)Command Line Format --ndb_cache_check_timeConfig File Format ndb_cache_check_timeOption Sets Variable Yes, ndb_cache_check_timeVariable Name ndb_cache_check_timeVariable Scope Global Dynamic Variable Yes Value Set Type numericDefault 0The number of milliseconds that elapse between checks of MySQL Cluster SQL nodes by the MySQL query cache. Setting this to 0 (the default and minimum value) means that the query cache checks for validation on every query.
The recommended maximum value for this variable is 1000, which means that the check is performed once per second. A larger value means that the check is performed and possibly invalidated due to updates on different SQL nodes less often. It is generally not desirable to set this to a value greater than 2000.
Version Introduced 5.1.6 Command Line Format ndb_extra_logging=#Config File Format ndb_extra_loggingVariable Name ndb_extra_loggingVariable Scope Global Dynamic Variable Yes Value Set Type numericDefault 0This variable can be used to enable recording in the MySQL error log of information specific to the
NDBstorage engine. It is normally of interest only when debuggingNDBstorage engine code.The default value is 0, which means that the only
NDB-specific information written to the MySQL error log relates to transaction handling. If the value is greater than 0 but less than 10,NDBtable schema and connection events are also logged, as well as whether or not conflict resolution is in use, and otherNDBerrors and information. If the value is set to 10 or more, information aboutNDBinternals, such as the progress of data distribution among cluster nodes, is also written to the MySQL error log.This variable was added in MySQL 5.1.6.
Command Line Format --ndb-force-sendConfig File Format ndb_force_sendOption Sets Variable Yes, ndb_force_sendVariable Name ndb_force_sendVariable Scope Both Dynamic Variable Yes Value Set Type booleanDefault TRUEForces sending of buffers to
NDBimmediately, without waiting for other threads. Defaults toON.Version Removed 5.1.14 Command Line Format --ndb_index_stat_cache_entriesConfig File Format ndb_index_stat_cache_entriesValue Set Type numericDefault 32Range 0-4294967295Sets the granularity of the statistics by determining the number of starting and ending keys to store in the statistics memory cache. Zero means no caching takes place; in this case, the data nodes are always queried directly. Default value:
32.Version Removed 5.1.19 Command Line Format --ndb_index_stat_enableConfig File Format ndb_index_stat_enableValue Set Type booleanDefault ONUse
NDBindex statistics in query optimization. Defaults toON.Version Removed 5.1.14 Command Line Format --ndb_index_stat_update_freqConfig File Format ndb_index_stat_update_freqValue Set Type numericDefault 20Range 0-4294967295How often to query data nodes instead of the statistics cache. For example, a value of
20(the default) means to direct every 20th query to the data nodes.Command Line Format --ndb-optimized-node-selectionConfig File Format ndb_optimized_node_selectionValue Set Type booleanDefault ONPrior to MySQL Cluster NDB 6.3.4. Causes an SQL node to use the “closest” data node as transaction coordinator. Enabled by default. Set to
0orOFFto disable, in which case the SQL node uses each data node in the cluster in succession. When this option is disabled each SQL thread attempts to use a given data node 8 times before proceeding to the next one.Beginning with MySQL Cluster NDB 6.3.4. There are two forms of optimized node selection:
The SQL node uses promixity to determine the transaction coordinator; that is, the “closest” data node to the SQL node is chosen as the transaction coordinator. For this purpose, a data node having a shared memory connection with the SQL node is considered to be “closest” to the SQL node; the next closest (in order of decreasing proximity) are: TCP connection to
localhost; SCI connection; TCP connection from a host other thanlocalhost.The SQL thread uses distribution awareness to select the data node. That is, the data node housing the cluster partition accessed by the first statement of a given transaction is used as the transaction coordinator for the entire transaction. (This is effective only if the first statement of the transaction accesses no more than one cluster partition.)
This option takes one of the integer values
0,1,2, or3.3is the default. These values affect node selection as follows:0: Node selection is not optimized. Each data node is employed as the transaction coordinator 8 times before the SQL thread proceeds to the next data node. (This is the same “round-robin” behavior as caused by setting this option to0orOFFin previous versions of MySQL Cluster.)1: Proximity to the SQL node is used to determine the transaction coordinator. (This is the same behavior as caused by setting this option to1orONin previous MySQL versions.)2: Distribution awareness is used to select the transaction coordinator. However, if the first statement of the transaction accesses more than one cluster partition, the SQL node reverts to the round-robin behavior seen when this option is set to0.3: If distribution awareness can be employed to determine the transaction coordinator, then it is used; otherwise proximity is used to select the transaction coordinator. (This is the default behavior in MySQL Cluster NDB 6.3.4 and later.)
Important
Beginning with MySQL Cluster NDB 6.3.4, it is no longer possible to set
--ndb_optimized_node_selectiontoONorOFF; attempting to do so causes mysqld to abort with an error.ndb_report_thresh_binlog_epoch_slipCommand Line Format --ndb_report_thresh_binlog_epoch_slipConfig File Format ndb_report_thresh_binlog_epoch_slipValue Set Type numericDefault 3Range 0-256This is a threshold on the number of epochs to be behind before reporting binlog status. For example, a value of
3(the default) means that if the difference between which epoch has been received from the storage nodes and which epoch has been applied to the binlog is 3 or more, a status message will be sent to the cluster log.ndb_report_thresh_binlog_mem_usageCommand Line Format --ndb_report_thresh_binlog_mem_usageConfig File Format ndb_report_thresh_binlog_mem_usageValue Set Type numericDefault 10Range 0-10This is a threshold on the percentage of free memory remaining before reporting binlog status. For example, a value of
10(the default) means that if the amount of available memory for receiving binlog data from the data nodes falls below 10%, a status message will be sent to the cluster log.Version Introduced 5.1.12 Variable Name ndb_use_copying_alter_tableVariable Scope Both Dynamic Variable No Forces
NDBto use copying of tables in the event of problems with onlineALTER TABLEoperations. The default value isOFF.This variable was added in MySQL 5.1.12.
Variable Name ndb_use_exact_countVariable Scope Both Dynamic Variable Yes Value Set Type booleanDefault ONForces
NDBto use a count of records duringSELECT COUNT(*)query planning to speed up this type of query. The default value isON. For faster queries overall, disable this feature by setting the value ofndb_use_exact_counttoOFF.Command Line Format --ndb_use_transactionsConfig File Format ndb_use_transactionsValue Set Type booleanDefault ONYou can disable
NDBtransaction support by setting this variable's values toOFF(not recommended). The default isON.Note
The setting for this variable was not honored in MySQL Cluster NDB 6.4.3 and MySQL Cluster NDB 7.0.4. (Bug#43236)
Version Introduced 5.1.16-ndb-6.2.0 Command Line Format ndb_wait_connectedConfig File Format ndb_wait_connectedOption Sets Variable Yes, ndb_wait_connectedVariable Name ndb_wait_connectedVariable Scope Dynamic Variable No Value Set Type numericDefault 0This variable can be used to cause the MySQL server to wait a given period of time for connections to MySQL Cluster management and data nodes to be established before accepting MySQL client connections. The time is specified in seconds. The default value is
0.
This section provides detailed information about MySQL server
status variables that relate to MySQL Cluster and the
NDB storage engine. For status
variables not specific to MySQL Cluster, and for general
information on using status variables, see
Server Status Variables.
The MySQL server can ask the
NDBCLUSTERstorage engine if it knows about a table with a given name. This is called discovery.Handler_discoverindicates the number of times that tables have been discovered via this mechanism.If the server is acting as a MySQL Cluster node, then the value of this variable its node ID in the cluster.
If the server is not part of a MySQL Cluster, then the value of this variable is 0.
If the server is part of a MySQL Cluster, the value of this variable is the host name or IP address of the Cluster management server from which it gets its configuration data.
If the server is not part of a MySQL Cluster, then the value of this variable is an empty string.
Prior to MySQL 5.1.12, this variable was named
Ndb_connected_host.If the server is part of a MySQL Cluster, the value of this variable is the number of the port through which it is connected to the Cluster management server from which it gets its configuration data.
If the server is not part of a MySQL Cluster, then the value of this variable is 0.
Prior to MySQL 5.1.12, this variable was named
Ndb_connected_port.Provides the number of round trips to the
NDBkernel made by operations. Added in MySQL Cluster NDB 6.3.6.If the server is part of a MySQL Cluster, the value of this variable is the number of data nodes in the cluster.
If the server is not part of a MySQL Cluster, then the value of this variable is 0.
Prior to MySQL 5.1.12, this variable was named
Ndb_number_of_storage_nodes.Shows the replication heartbeat interval (in seconds) on a replication slave.
This variable was added in MySQL Cluster NDB 6.3.4.
This counter increments with each replication heartbeat received by a replication slave since the last time that the slave was restarted or reset, or a
CHANGE MASTER TOstatement was issued.This variable was added in MySQL Cluster NDB 6.3.4.
This variable holds a count of the number of scans executed by
NDBCLUSTERsince the MySQL Cluster was last started whereNDBCLUSTERwas able to use partition pruning.Using this variable together with
Ndb_scan_countcan be helpful in schema design to maximize the ability of the server to prune scans to a single table partition, thereby involving only a single data node.This variable was added in MySQL Cluster NDB 6.3.25 and MySQL Cluster NDB 7.0.5.
This variable holds a count of the total number of scans executed by
NDBCLUSTERsince the MySQL Cluster was last started.This variable was added in MySQL Cluster NDB 6.3.25 and MySQL Cluster NDB 7.0.5.
