Personal tools
You are here: Home Docs MySQL Cluster Excerpt 5.1 Chapter 4. MySQL Cluster Options and Variables

Chapter 4. MySQL Cluster Options and Variables

Chapter 4. MySQL Cluster Options and Variables

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.

4.1. MySQL Cluster Server Option and Variable Reference

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

NameCmd-LineOption fileSystem VarStatus VarVar ScopeDynamic
Handler_discover   YesBothNo
have_ndbcluster  Yes GlobalNo
ndb_autoincrement_prefetch_szYesYesYes BothYes
ndb-batch-sizeYesYesYes GlobalNo
ndb_cache_check_timeYesYesYes GlobalYes
ndb-cluster-connection-poolYesYes YesGlobalNo
Ndb_cluster_node_id   YesBothNo
Ndb_config_from_host   YesBothNo
Ndb_config_from_port   YesBothNo
Ndb_conflict_fn_max   YesGlobalNo
Ndb_conflict_fn_old   YesGlobalNo
ndb-connectstringYesYes    
ndb_execute_count   YesGlobalNo
ndb_extra_loggingYesYesYes GlobalYes
ndb_force_sendYesYesYes BothYes
ndb_index_stat_cache_entriesYesYes    
ndb_index_stat_enableYesYes    
ndb_index_stat_update_freqYesYes    
ndb_log_empty_epochsYesYesYes GlobalYes
ndb_log_orig  Yes GlobalNo
ndb-log-update-as-writeYesYesYes GlobalYes
ndb_log_updated_onlyYesYesYes GlobalYes
ndb-mgmd-hostYesYes    
ndb-nodeidYesYes YesGlobalNo
Ndb_number_of_data_nodes   YesGlobalNo
ndb_optimization_delay  Yes GlobalYes
ndb_optimized_node_selectionYesYes    
ndb_pruned_scan_count   YesGlobalNo
ndb_report_thresh_binlog_epoch_slipYesYes    
ndb_report_thresh_binlog_mem_usageYesYes    
ndb_scan_count   YesGlobalNo
ndb_table_no_logging  Yes SessionYes
ndb_table_temporary  Yes SessionYes
ndb_use_copying_alter_table  Yes BothNo
ndb_use_exact_count  Yes BothYes
ndb_use_transactionsYesYes    
ndb_wait_connectedYesYesYes  No
ndbclusterYesYes    
skip-ndbclusterYesYes    
slave-allow-batchingYesYes  GlobalYes
- Variable: slave_allow_batching  Yes GlobalYes

4.2. mysqld Command Options for MySQL Cluster

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.

  • --ndb-batch-size=#

    Version Introduced5.1.23-ndb-6.3.8
    Command Line Format--ndb-batch-size
    Config File Formatndb-batch-size
    Variable Namendb_batch_size
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default32768
    Range0-31536000

    This sets the size in bytes that is used for NDB transaction batches.

  • --ndb-cluster-connection-pool=#

    Version Introduced5.1.19-ndb-6.2.2
    Command Line Format--ndb-cluster-connection-pool
    Config File Formatndb-cluster-connection-pool
    Variable NameNdb_cluster_connection_pool
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default1
    Range1-63

    By 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-pool option 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_string

    Command Line Format--ndb-connectstring
    Config File Formatndb-connectstring
    Value Set
    Typestring

    When using the NDBCLUSTER storage engine, this option specifies the management server that distributes cluster configuration data. See Section 3.4.3, “The MySQL Cluster Connectstring”, for syntax.

  • --ndbcluster

    Command Line Format--ndbcluster
    Config File Formatndbcluster
    Value Set
    Typeboolean
    DefaultFALSE

    The NDBCLUSTER storage engine is necessary for using MySQL Cluster. If a mysqld binary includes support for the NDBCLUSTER storage engine, the engine is disabled by default. Use the --ndbcluster option to enable it. Use --skip-ndbcluster to explicitly disable the engine.

  • --ndb-nodeid=#

    Version Introduced5.1.15
    Command Line Format--ndb-nodeid=#
    Config File Formatndb-nodeid
    Variable NameNdb_cluster_node_id
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set (>= 5.1.5)
    Typenumeric
    Range1-255

    Set 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.ini file, or allowing the cluster to determine an arbitrary node ID. If you use this option, then --ndb-nodeid must be specified before --ndb-connectstring. If --ndb-nodeid is 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 --nodeid is used, then either a matching node ID must be found in a [mysqld] or [api] section of config.ini, or there must be an “open[mysqld] or [api] section in the file (that is, a section without an Id parameter specified).

    Regardless of how the node ID is determined, its is shown as the value of the global status variable Ndb_cluster_node_id in the output of SHOW STATUS, and as cluster_node_id in the connection row of the output of SHOW 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”.

  • --skip-ndbcluster

    Command Line Format--skip-ndbcluster
    Config File Formatskip-ndbcluster

    Disable the NDBCLUSTER storage engine. This is the default for binaries that were built with NDBCLUSTER storage engine support; the server allocates memory and other resources for this storage engine only if the --ndbcluster option is given explicitly. See Section 3.3, “Quick Test Setup of MySQL Cluster”, for an example.

4.3. MySQL Cluster System Variables

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.

  • have_ndbcluster

    Variable Namehave_ndbcluster
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typeboolean

    YES if mysqld supports NDBCLUSTER tables. DISABLED if --skip-ndbcluster is used.

  • multi_range_count

    Command Line Format--multi_range_count=#
    Config File Formatmulti_range_count
    Option Sets VariableYes, multi_range_count
    Variable Namemulti_range_count
    Variable ScopeBoth
    Dynamic VariableYes
    Value Set
    Typenumeric
    Default256
    Range1-4294967295

    The 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 NDBCLUSTER table 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.

  • ndb_autoincrement_prefetch_sz

    Command Line Format--ndb_autoincrement_prefetch_sz
    Config File Formatndb_autoincrement_prefetch_sz
    Option Sets VariableYes, ndb_autoincrement_prefetch_sz
    Variable Namendb_autoincrement_prefetch_sz
    Variable ScopeBoth
    Dynamic VariableYes
    Value Set (<= 5.1.22)
    Typenumeric
    Default32
    Range1-256
    Value Set (>= 5.1.23)
    Typenumeric
    Default1
    Range1-256

    Determines the probability of gaps in an autoincremented column. Set it to 1 to 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_INCREMENT IDs that are fetched between statements only. Within a statement, at least 32 IDs are now obtained at a time. The default value for ndb_autoincrement_prefetch_sz is now 1, to increase the speed of statements inserting single rows. (Bug#31956)

  • ndb_cache_check_time

    Command Line Format--ndb_cache_check_time
    Config File Formatndb_cache_check_time
    Option Sets VariableYes, ndb_cache_check_time
    Variable Namendb_cache_check_time
    Variable ScopeGlobal
    Dynamic VariableYes
    Value Set
    Typenumeric
    Default0

    The 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.

  • ndb_extra_logging

    Version Introduced5.1.6
    Command Line Formatndb_extra_logging=#
    Config File Formatndb_extra_logging
    Variable Namendb_extra_logging
    Variable ScopeGlobal
    Dynamic VariableYes
    Value Set
    Typenumeric
    Default0

    This variable can be used to enable recording in the MySQL error log of information specific to the NDB storage engine. It is normally of interest only when debugging NDB storage 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, NDB table schema and connection events are also logged, as well as whether or not conflict resolution is in use, and other NDB errors and information. If the value is set to 10 or more, information about NDB internals, 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.

  • ndb_force_send

    Command Line Format--ndb-force-send
    Config File Formatndb_force_send
    Option Sets VariableYes, ndb_force_send
    Variable Namendb_force_send
    Variable ScopeBoth
    Dynamic VariableYes
    Value Set
    Typeboolean
    DefaultTRUE

    Forces sending of buffers to NDB immediately, without waiting for other threads. Defaults to ON.

  • ndb_index_stat_cache_entries

    Version Removed5.1.14
    Command Line Format--ndb_index_stat_cache_entries
    Config File Formatndb_index_stat_cache_entries
    Value Set
    Typenumeric
    Default32
    Range0-4294967295

    Sets 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.

  • ndb_index_stat_enable

    Version Removed5.1.19
    Command Line Format--ndb_index_stat_enable
    Config File Formatndb_index_stat_enable
    Value Set
    Typeboolean
    DefaultON

    Use NDB index statistics in query optimization. Defaults to ON.

  • ndb_index_stat_update_freq

    Version Removed5.1.14
    Command Line Format--ndb_index_stat_update_freq
    Config File Formatndb_index_stat_update_freq
    Value Set
    Typenumeric
    Default20
    Range0-4294967295

    How 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.

  • ndb_optimized_node_selection

    Command Line Format--ndb-optimized-node-selection
    Config File Formatndb_optimized_node_selection
    Value Set
    Typeboolean
    DefaultON

    Prior 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 0 or OFF to 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:

    1. 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 than localhost.

    2. 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, or 3. 3 is 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 to 0 or OFF in 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 to 1 or ON in 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 to 0.

    • 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_selection to ON or OFF; attempting to do so causes mysqld to abort with an error.

  • ndb_report_thresh_binlog_epoch_slip

    Command Line Format--ndb_report_thresh_binlog_epoch_slip
    Config File Formatndb_report_thresh_binlog_epoch_slip
    Value Set
    Typenumeric
    Default3
    Range0-256

    This 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_usage

    Command Line Format--ndb_report_thresh_binlog_mem_usage
    Config File Formatndb_report_thresh_binlog_mem_usage
    Value Set
    Typenumeric
    Default10
    Range0-10

    This 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.

  • ndb_use_copying_alter_table

    Version Introduced5.1.12
    Variable Namendb_use_copying_alter_table
    Variable ScopeBoth
    Dynamic VariableNo

    Forces NDB to use copying of tables in the event of problems with online ALTER TABLE operations. The default value is OFF.

    This variable was added in MySQL 5.1.12.

  • ndb_use_exact_count

    Variable Namendb_use_exact_count
    Variable ScopeBoth
    Dynamic VariableYes
    Value Set
    Typeboolean
    DefaultON

    Forces NDB to use a count of records during SELECT COUNT(*) query planning to speed up this type of query. The default value is ON. For faster queries overall, disable this feature by setting the value of ndb_use_exact_count to OFF.

  • ndb_use_transactions

    Command Line Format--ndb_use_transactions
    Config File Formatndb_use_transactions
    Value Set
    Typeboolean
    DefaultON

    You can disable NDB transaction support by setting this variable's values to OFF (not recommended). The default is ON.

    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)

  • ndb_wait_connected

    Version Introduced5.1.16-ndb-6.2.0
    Command Line Formatndb_wait_connected
    Config File Formatndb_wait_connected
    Option Sets VariableYes, ndb_wait_connected
    Variable Namendb_wait_connected
    Variable Scope 
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default0

    This 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.

4.4. MySQL Cluster Status Variables

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.

  • Handler_discover

    The MySQL server can ask the NDBCLUSTER storage engine if it knows about a table with a given name. This is called discovery. Handler_discover indicates the number of times that tables have been discovered via this mechanism.

  • Ndb_cluster_node_id

    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.

  • Ndb_config_from_host

    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.

  • Ndb_config_from_port

    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.

  • Ndb_execute_count

    Provides the number of round trips to the NDB kernel made by operations. Added in MySQL Cluster NDB 6.3.6.

  • Ndb_number_of_data_nodes

    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.

  • Slave_heartbeat_period

    Shows the replication heartbeat interval (in seconds) on a replication slave.

    This variable was added in MySQL Cluster NDB 6.3.4.

  • Slave_received_heartbeats

    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 TO statement was issued.

    This variable was added in MySQL Cluster NDB 6.3.4.

  • Ndb_pruned_scan_count

    This variable holds a count of the number of scans executed by NDBCLUSTER since the MySQL Cluster was last started where NDBCLUSTER was able to use partition pruning.

    Using this variable together with Ndb_scan_count can 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.

  • Ndb_scan_count

    This variable holds a count of the total number of scans executed by NDBCLUSTER since the MySQL Cluster was last started.

    This variable was added in MySQL Cluster NDB 6.3.25 and MySQL Cluster NDB 7.0.5.

Document Actions