Cari di MySQL 
    MySQL Manual
Daftar Isi
(Sebelumnya) 17. MySQL Cluster NDB 7.217.3.3. Overview of MySQL Clus ... (Berikutnya)

17.3. MySQL Cluster Configuration

A MySQL server that is part of a MySQL Cluster differs in one chief respect from a normal (nonclustered) MySQL server, in that it employs the NDBCLUSTER storage engine. This engine is also referred to simply as NDB, and the two forms of the name are synonymous.

To avoid unnecessary allocation of resources, the server is configured by default with the NDB storage engine disabled. To enable NDB, you must modify the server's my.cnf configuration file, or start the server with the --ndbcluster option.

For more information about --ndbcluster and other MySQL server options specific to MySQL Cluster, see Section 17.3.4.2, "MySQL Server Options for MySQL Cluster".

The MySQL server is a part of the cluster, so it also must know how to access an MGM node to obtain the cluster configuration data. The default behavior is to look for the MGM node on localhost. However, should you need to specify that its location is elsewhere, this can be done in my.cnf or on the MySQL server command line. Before the NDB storage engine can be used, at least one MGM node must be operational, as well as any desired data nodes.

NDB, the MySQL Cluster storage engine, is available in binary distributions for Linux, Mac OS X, Solaris. and Windows. We are working to support MySQL Cluster on all operating systems supported by the MySQL Server. For information about installing MySQL Cluster, see Section 17.2, "MySQL Cluster Installation".

17.3.1. Quick Test Setup of MySQL Cluster

To familiarize you with the basics, we will describe the simplest possible configuration for a functional MySQL Cluster. After this, you should be able to design your desired setup from the information provided in the other relevant sections of this chapter.

First, you need to create a configuration directory such as /var/lib/mysql-cluster, by executing the following command as the system root user:

shell> mkdir /var/lib/mysql-cluster

In this directory, create a file named config.ini that contains the following information. Substitute appropriate values for HostName and DataDir as necessary for your system.

# file "config.ini" - showing minimal setup consisting of 1 data node,# 1 management server, and 3 MySQL servers.# The empty default sections are not required, and are shown only for# the sake of completeness.# Data nodes must provide a hostname but MySQL Servers are not required# to do so.# If you don't know the hostname for your machine, use localhost.# The DataDir parameter also has a default value, but it is recommended to# set it explicitly.# Note: [db], [api], and [mgm] are aliases for [ndbd], [mysqld], and [ndb_mgmd],# respectively. [db] is deprecated and should not be used in new installations.[ndbd default]NoOfReplicas= 1[mysqld  default][ndb_mgmd default][tcp default][ndb_mgmd]HostName= myhost.example.com[ndbd]HostName= myhost.example.comDataDir= /var/lib/mysql-cluster[mysqld][mysqld][mysqld]

You can now start the ndb_mgmd management server. By default, it attempts to read the config.ini file in its current working directory, so change location into the directory where the file is located and then invoke ndb_mgmd:

shell> cd /var/lib/mysql-clustershell> ndb_mgmd

Then start a single data node by running ndbd:

shell> ndbd

For command-line options which can be used when starting ndbd, see Section 17.4.24, "Options Common to MySQL Cluster Programs - Options Common to MySQL Cluster Programs".

By default, ndbd looks for the management server at localhost on port 1186.

Note

If you have installed MySQL from a binary tarball, you will need to specify the path of the ndb_mgmd and ndbd servers explicitly. (Normally, these will be found in /usr/local/mysql/bin.)

Finally, change location to the MySQL data directory (usually /var/lib/mysql or /usr/local/mysql/data), and make sure that the my.cnf file contains the option necessary to enable the NDB storage engine:

[mysqld]ndbcluster

You can now start the MySQL server as usual:

shell> mysqld_safe --user=mysql &

Wait a moment to make sure the MySQL server is running properly. If you see the notice mysql ended, check the server's .err file to find out what went wrong.

If all has gone well so far, you now can start using the cluster. Connect to the server and verify that the NDBCLUSTER storage engine is enabled:

shell> mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1 to server version: 5.5.31Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> SHOW ENGINES\G...*************************** 12. row ***************************Engine: NDBCLUSTERSupport: YESComment: Clustered, fault-tolerant, memory-based tables*************************** 13. row ***************************Engine: NDBSupport: YESComment: Alias for NDBCLUSTER...

The row numbers shown in the preceding example output may be different from those shown on your system, depending upon how your server is configured.

Try to create an NDBCLUSTER table:

shell> mysqlmysql> USE test;Database changedmysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;Query OK, 0 rows affected (0.09 sec)mysql> SHOW CREATE TABLE ctest \G*************************** 1. row ***************************   Table: ctestCreate Table: CREATE TABLE `ctest` (  `i` int(11) default NULL) ENGINE=ndbcluster DEFAULT CHARSET=latin11 row in set (0.00 sec)

To check that your nodes were set up properly, start the management client:

shell> ndb_mgm

Use the SHOW command from within the management client to obtain a report on the cluster's status:

ndb_mgm> SHOWCluster Configuration---------------------[ndbd(NDB)] 1 node(s)id=2 @127.0.0.1  (Version: 5.5.29-ndb-7.2.10, Nodegroup: 0, Master)[ndb_mgmd(MGM)] 1 node(s)id=1 @127.0.0.1  (Version: 5.5.29-ndb-7.2.10)[mysqld(API)]   3 node(s)id=3 @127.0.0.1  (Version: 5.5.29-ndb-7.2.10)id=4 (not connected, accepting connect from any host)id=5 (not connected, accepting connect from any host)

At this point, you have successfully set up a working MySQL Cluster. You can now store data in the cluster by using any table created with ENGINE=NDBCLUSTER or its alias ENGINE=NDB.

17.3.2. MySQL Cluster Configuration Files

Configuring MySQL Cluster requires working with two files:

  • my.cnf: Specifies options for all MySQL Cluster executables. This file, with which you should be familiar with from previous work with MySQL, must be accessible by each executable running in the cluster.

  • config.ini: This file, sometimes known as the global configuration file, is read only by the MySQL Cluster management server, which then distributes the information contained therein to all processes participating in the cluster. config.ini contains a description of each node involved in the cluster. This includes configuration parameters for data nodes and configuration parameters for connections between all nodes in the cluster. For a quick reference to the sections that can appear in this file, and what sorts of configuration parameters may be placed in each section, see Sections of the config.ini File.

Caching of configuration data. In MySQL Cluster NDB 7.2, MySQL Cluster uses stateful configuration. Rather than reading the global configuration file every time the management server is restarted, the management server caches the configuration the first time it is started, and thereafter, the global configuration file is read only when one of the following conditions is true:

  • The management server is started using the --initial option. In this case, the global configuration file is re-read, any existing cache files are deleted, and the management server creates a new configuration cache.

  • The management server is started using the --reload option. In this case, the management server compares its cache with the global configuration file. If they differ, the management server creates a new configuration cache; any existing configuration cache is preserved, but not used. If the management server's cache and the global configuration file contain the same configuration data, then the existing cache is used, and no new cache is created.

  • The management server is started using a --config-cache option. This option can be used to force the management server to bypass configuration caching altogether. In this case, the management server ignores any configuration files that may be present, always reading its configuration data from the config.ini file instead.

  • No configuration cache is found. In this case, the management server reads the global configuration file and creates a cache containing the same configuration data as found in the file.

Configuration cache files. The management server by default creates configuration cache files in a directory named mysql-cluster in the MySQL installation directory. (If you build MySQL Cluster from source on a Unix system, the default location is /usr/local/mysql-cluster.) This can be overridden at run time by starting the management server with the --configdir option. Configuration cache files are binary files named according to the pattern ndb_node_id_config.bin.seq_id, where node_id is the management server's node ID in the cluster, and seq_id is a cache idenitifer. Cache files are numbered sequentially using seq_id, in the order in which they are created. The management server uses the latest cache file as determined by the seq_id.

Note

It is possible to roll back to a previous configuration by deleting later configuration cache files, or by renaming an earlier cache file so that it has a higher seq_id. However, since configuration cache files are written in a binary format, you should not attempt to edit their contents by hand.

For more information about the --configdir, --initial, and --reload options for the MySQL Cluster management server, see Section 17.4.4, "ndb_mgmd - The MySQL Cluster Management Server Daemon".

We are continuously making improvements in Cluster configuration and attempting to simplify this process. Although we strive to maintain backward compatibility, there may be times when introduce an incompatible change. In such cases we will try to let Cluster users know in advance if a change is not backward compatible. If you find such a change and we have not documented it, please report it in the MySQL bugs database using the instructions given in Section 1.7, "How to Report Bugs or Problems".

17.3.2.1. MySQL Cluster Configuration: Basic Example

To support MySQL Cluster, you will need to update my.cnf as shown in the following example. You may also specify these parameters on the command line when invoking the executables.

Note

The options shown here should not be confused with those that are used in config.ini global configuration files. Global configuration options are discussed later in this section.

# my.cnf# example additions to my.cnf for MySQL Cluster# (valid in MySQL 5.5)# enable ndbcluster storage engine, and provide connectstring for# management server host (default port is 1186)[mysqld]ndbclusterndb-connectstring=ndb_mgmd.mysql.com# provide connectstring for management server host (default port: 1186)[ndbd]connect-string=ndb_mgmd.mysql.com# provide connectstring for management server host (default port: 1186)[ndb_mgm]connect-string=ndb_mgmd.mysql.com# provide location of cluster configuration file[ndb_mgmd]config-file=/etc/config.ini

(For more information on connectstrings, see Section 17.3.2.3, "The MySQL Cluster Connectstring".)

# my.cnf# example additions to my.cnf for MySQL Cluster# (will work on all versions)# enable ndbcluster storage engine, and provide connectstring for management# server host to the default port 1186[mysqld]ndbclusterndb-connectstring=ndb_mgmd.mysql.com:1186
Important

Once you have started a mysqld process with the NDBCLUSTER and ndb-connectstring parameters in the [mysqld] in the my.cnf file as shown previously, you cannot execute any CREATE TABLE or ALTER TABLE statements without having actually started the cluster. Otherwise, these statements will fail with an error. This is by design.

You may also use a separate [mysql_cluster] section in the cluster my.cnf file for settings to be read and used by all executables:

# cluster-specific settings[mysql_cluster]ndb-connectstring=ndb_mgmd.mysql.com:1186

For additional NDB variables that can be set in the my.cnf file, see Section 17.3.4.3, "MySQL Cluster System Variables".

The MySQL Cluster global configuration file is named config.ini by default. It is read by ndb_mgmd at startup and can be placed anywhere. Its location and name are specified by using --config-file=path_name on the ndb_mgmd command line. If the configuration file is not specified, ndb_mgmd by default tries to read a file named config.ini located in the current working directory.

The global configuration file for MySQL Cluster uses INI format, which consists of sections preceded by section headings (surrounded by square brackets), followed by the appropriate parameter names and values. One deviation from the standard INI format is that the parameter name and value can be separated by a colon (":") as well as the equal sign ("="); however, the equal sign is preferred. Another deviation is that sections are not uniquely identified by section name. Instead, unique sections (such as two different nodes of the same type) are identified by a unique ID specified as a parameter within the section.

Default values are defined for most parameters, and can also be specified in config.ini. To create a default value section, simply add the word default to the section name. For example, an [ndbd] section contains parameters that apply to a particular data node, whereas an [ndbd default] section contains parameters that apply to all data nodes. Suppose that all data nodes should use the same data memory size. To configure them all, create an [ndbd default] section that contains a DataMemory line to specify the data memory size.

Note

In some older releases of MySQL Cluster, there was no default value for NoOfReplicas, which always had to be specified explicitly in the [ndbd default] section. Although this parameter now has a default value of 2, which is the recommended setting in most common usage scenarios, it is still recommended practice to set this parameter explicitly.

The global configuration file must define the computers and nodes involved in the cluster and on which computers these nodes are located. An example of a simple configuration file for a cluster consisting of one management server, two data nodes and two MySQL servers is shown here:

# file "config.ini" - 2 data nodes and 2 SQL nodes# This file is placed in the startup directory of ndb_mgmd (the# management server)# The first MySQL Server can be started from any host. The second# can be started only on the host mysqld_5.mysql.com[ndbd default]NoOfReplicas= 2DataDir= /var/lib/mysql-cluster[ndb_mgmd]Hostname= ndb_mgmd.mysql.comDataDir= /var/lib/mysql-cluster[ndbd]HostName= ndbd_2.mysql.com[ndbd]HostName= ndbd_3.mysql.com[mysqld][mysqld]HostName= mysqld_5.mysql.com
Note

The preceding example is intended as a minimal starting configuration for purposes of familiarization with MySQL Cluster, and is almost certain not to be sufficient for production settings. See Section 17.3.2.2, "Recommended Starting Configuration for MySQL Cluster", which provides a more complete example starting configuration.

Each node has its own section in the config.ini file. For example, this cluster has two data nodes, so the preceding configuration file contains two [ndbd] sections defining these nodes.

Note

Do not place comments on the same line as a section heading in the config.ini file; this causes the management server not to start because it cannot parse the configuration file in such cases.

Sections of the config.ini File

There are six different sections that you can use in the config.ini configuration file, as described in the following list:

You can define default values for each section. All Cluster parameter names are case-insensitive, which differs from parameters specified in my.cnf or my.ini files.

17.3.2.2. Recommended Starting Configuration for MySQL Cluster

Achieving the best performance from a MySQL Cluster depends on a number of factors including the following:

  • MySQL Cluster software version

  • Numbers of data nodes and SQL nodes

  • Hardware

  • Operating system

  • Amount of data to be stored

  • Size and type of load under which the cluster is to operate

Therefore, obtaining an optimum configuration is likely to be an iterative process, the outcome of which can vary widely with the specifics of each MySQL Cluster deployment. Changes in configuration are also likely to be indicated when changes are made in the platform on which the cluster is run, or in applications that use the MySQL Cluster's data. For these reasons, it is not possible to offer a single configuration that is ideal for all usage scenarios. However, in this section, we provide a recommended base configuration.

Starting config.ini file. The following config.ini file is a recommended starting point for configuring a cluster running MySQL Cluster NDB 7.2:

# TCP PARAMETERS[tcp default]SendBufferMemory=2MReceiveBufferMemory=2M# Increasing the sizes of these 2 buffers beyond the default values# helps prevent bottlenecks due to slow disk I/O.# MANAGEMENT NODE PARAMETERS[ndb_mgmd default]DataDir=path/to/management/server/data/directory# It is possible to use a different data directory for each management# server, but for ease of administration it is preferable to be# consistent.[ndb_mgmd]HostName=management-server-A-hostname# NodeId=management-server-A-nodeid[ndb_mgmd]HostName=management-server-B-hostname# NodeId=management-server-B-nodeid# Using 2 management servers helps guarantee that there is always an# arbitrator in the event of network partitioning, and so is# recommended for high availability. Each management server must be# identified by a HostName. You may for the sake of convenience specify# a NodeId for any management server, although one will be allocated# for it automatically; if you do so, it must be in the range 1-255# inclusive and must be unique among all IDs specified for cluster# nodes.# DATA NODE PARAMETERS[ndbd default]NoOfReplicas=2# Using 2 replicas is recommended to guarantee availability of data; # using only 1 replica does not provide any redundancy, which means # that the failure of a single data node causes the entire cluster to # shut down. We do not recommend using more than 2 replicas, since 2 is # sufficient to provide high availability, and we do not currently test # with greater values for this parameter.LockPagesInMainMemory=1# On Linux and Solaris systems, setting this parameter locks data node# processes into memory. Doing so prevents them from swapping to disk,# which can severely degrade cluster performance.DataMemory=3072MIndexMemory=384M# The values provided for DataMemory and IndexMemory assume 4 GB RAM# per data node. However, for best results, you should first calculate# the memory that would be used based on the data you actually plan to# store (you may find the ndb_size.pl utility helpful in estimating# this), then allow an extra 20% over the calculated values. Naturally,# you should ensure that each data node host has at least as much# physical memory as the sum of these two values.# ODirect=1# Enabling this parameter causes NDBCLUSTER to try using O_DIRECT# writes for local checkpoints and redo logs; this can reduce load on# CPUs. We recommend doing so when using MySQL Cluster on systems running # Linux kernel 2.6 or later.NoOfFragmentLogFiles=300DataDir=path/to/data/node/data/directoryMaxNoOfConcurrentOperations=100000SchedulerSpinTimer=400SchedulerExecutionTimer=100RealTimeScheduler=1# Setting these parameters allows you to take advantage of real-time scheduling# of NDBCLUSTER threads to get higher throughput.TimeBetweenGlobalCheckpoints=1000TimeBetweenEpochs=200DiskCheckpointSpeed=10MDiskCheckpointSpeedInRestart=100MRedoBuffer=32M# CompressedLCP=1# CompressedBackup=1# Enabling CompressedLCP and CompressedBackup causes, respectively, localcheckpoint files and backup files to be compressed, which can result in a spacesavings of up to 50% over noncompressed LCPs and backups.# MaxNoOfLocalScans=64MaxNoOfTables=1024MaxNoOfOrderedIndexes=256[ndbd]HostName=data-node-A-hostname# NodeId=data-node-A-nodeidLockExecuteThreadToCPU=1LockMaintThreadsToCPU=0# On systems with multiple CPUs, these parameters can be used to lock NDBCLUSTER# threads to specific CPUs[ndbd]HostName=data-node-B-hostname# NodeId=data-node-B-nodeidLockExecuteThreadToCPU=1LockMaintThreadsToCPU=0# You must have an [ndbd] section for every data node in the cluster;# each of these sections must include a HostName. Each section may# optionally include a NodeId for convenience, but in most cases, it is# sufficient to allow the cluster to allocate node IDs dynamically. If# you do specify the node ID for a data node, it must be in the range 1# to 48 inclusive and must be unique among all IDs specified for# cluster nodes.# SQL NODE / API NODE PARAMETERS[mysqld]# HostName=sql-node-A-hostname# NodeId=sql-node-A-nodeid[mysqld][mysqld]# Each API or SQL node that connects to the cluster requires a [mysqld]# or [api] section of its own. Each such section defines a connection# "slot"; you should have at least as many of these sections in the# config.ini file as the total number of API nodes and SQL nodes that# you wish to have connected to the cluster at any given time. There is# no performance or other penalty for having extra slots available in# case you find later that you want or need more API or SQL nodes to# connect to the cluster at the same time.# If no HostName is specified for a given [mysqld] or [api] section,# then any API or SQL node may use that slot to connect to the# cluster. You may wish to use an explicit HostName for one connection slot# to guarantee that an API or SQL node from that host can always# connect to the cluster. If you wish to prevent API or SQL nodes from# connecting from other than a desired host or hosts, then use a# HostName for every [mysqld] or [api] section in the config.ini file.# You can if you wish define a node ID (NodeId parameter) for any API or# SQL node, but this is not necessary; if you do so, it must be in the# range 1 to 255 inclusive and must be unique among all IDs specified# for cluster nodes.

Recommended my.cnf options for SQL nodes. MySQL Servers acting as MySQL Cluster SQL nodes must always be started with the --ndbcluster and --ndb-connectstring options, either on the command line or in my.cnf. In addition, set the following options for all mysqld processes in the cluster, unless your setup requires otherwise:

  • --ndb-use-exact-count=0

  • --ndb-index-stat-enable=0

  • --ndb-force-send=1

  • --engine-condition-pushdown=1

17.3.2.3. The MySQL Cluster Connectstring

With the exception of the MySQL Cluster management server (ndb_mgmd), each node that is part of a MySQL Cluster requires a connectstring that points to the management server's location. This connectstring is used in establishing a connection to the management server as well as in performing other tasks depending on the node's role in the cluster. The syntax for a connectstring is as follows:

[nodeid=node_id, ]host-definition[, host-definition[, ...]]host-definition: host_name[:port_number]

node_id is an integer larger than 1 which identifies a node in config.ini. host_name is a string representing a valid Internet host name or IP address. port_number is an integer referring to a TCP/IP port number.

example 1 (long): "nodeid=2,myhost1:1100,myhost2:1100,192.168.0.3:1200"example 2 (short):   "myhost1"

localhost:1186 is used as the default connectstring value if none is provided. If port_num is omitted from the connectstring, the default port is 1186. This port should always be available on the network because it has been assigned by IANA for this purpose (see http://www.iana.org/assignments/port-numbers for details).

By listing multiple host definitions, it is possible to designate several redundant management servers. A MySQL Cluster data or API node attempts to contact successive management servers on each host in the order specified, until a successful connection has been established.

It is also possible to specify in a connectstring one or more bind addresses to be used by nodes having multiple network interfaces for connecting to management servers. A bind address consists of a hostname or network address and an optional port number. This enhanced syntax for connectstrings is shown here:

[nodeid=node_id, ] [bind-address=host-definition, ] host-definition[; bind-address=host-definition] host-definition[; bind-address=host-definition] [, ...]]host-definition: host_name[:port_number]

If a single bind address is used in the connectstring prior to specifying any management hosts, then this address is used as the default for connecting to any of them (unless overridden for a given management server; see later in this section for an example). For example, the following connectstring causes the node to use 192.168.178.242 regardless of the management server to which it connects:

bind-address=192.168.178.242, poseidon:1186, perch:1186

If a bind address is specified following a management host definition, then it is used only for connecting to that management node. Consider the following connectstring:

poseidon:1186;bind-address=localhost, perch:1186;bind-address=192.168.178.242

In this case, the node uses localhost to connect to the management server running on the host named poseidon and 192.168.178.242 to connect to the management server running on the host named perch.

You can specify a default bind address and then override this default for one or more specific management hosts. In the following example, localhost is used for connecting to the management server running on host poseidon; since 192.168.178.242 is specified first (before any management server definitions), it is the default bind address and so is used for connecting to the management servers on hosts perch and orca:

bind-address=192.168.178.242,poseidon:1186;bind-address=localhost,perch:1186,orca:2200

There are a number of different ways to specify the connectstring:

  • Each executable has its own command-line option which enables specifying the management server at startup. (See the documentation for the respective executable.)

  • It is also possible to set the connectstring for all nodes in the cluster at once by placing it in a [mysql_cluster] section in the management server's my.cnf file.

  • For backward compatibility, two other options are available, using the same syntax:

    1. Set the NDB_CONNECTSTRING environment variable to contain the connectstring.

    2. Write the connectstring for each executable into a text file named Ndb.cfg and place this file in the executable's startup directory.

    However, these are now deprecated and should not be used for new installations.

The recommended method for specifying the connectstring is to set it on the command line or in the my.cnf file for each executable.

17.3.2.4. Defining Computers in a MySQL Cluster

The [computer] section has no real significance other than serving as a way to avoid the need of defining host names for each node in the system. All parameters mentioned here are required.

  • Id

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0string[none]...
    Restart Type: IN

    This is a unique identifier, used to refer to the host computer elsewhere in the configuration file.

    Important

    The computer ID is not the same as the node ID used for a management, API, or data node. Unlike the case with node IDs, you cannot use NodeId in place of Id in the [computer] section of the config.ini file.

  • HostName

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: S

    This is the computer's hostname or IP address.

17.3.2.5. Defining a MySQL Cluster Management Server

The [ndb_mgmd] section is used to configure the behavior of the management server. [mgm] can be used as an alias; the two section names are equivalent. All parameters in the following list are optional and assume their default values if omitted.

Note

If neither the ExecuteOnComputer nor the HostName parameter is present, the default value localhost will be assumed for both.

  • Id

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.1.1unsigned[none]1 - 255
    Restart Type: N

    Each node in the cluster has a unique identity. For a management node, this is represented by an integer value in the range 1 to 255, inclusive. This ID is used by all internal cluster messages for addressing the node, and so must be unique for each MySQL Cluster node, regardless of the type of node.

    Note

    Data node IDs must be less than 49. If you plan to deploy a large number of data nodes, it is a good idea to limit the node IDs for management nodes (and API nodes) to values greater than 48.

    The use of the Id parameter for identifying management nodes is deprecated in favor of NodeId. Although Id continues to be supported for backward compatibility, it now generates a warning and is subject to removal in a future version of MySQL Cluster.

  • NodeId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.1.1unsigned[none]1 - 255
    Restart Type: N

    Each node in the cluster has a unique identity. For a management node, this is represented by an integer value in the range 1 to 255 inclusive. This ID is used by all internal cluster messages for addressing the node, and so must be unique for each MySQL Cluster node, regardless of the type of node.

    Note

    Data node IDs must be less than 49. If you plan to deploy a large number of data nodes, it is a good idea to limit the node IDs for management nodes (and API nodes) to values greater than 48.

    NodeId is the preferred parameter name to use when identifying management nodes. Although the older Id continues to be supported for backward compatibility, it is now deprecated and generates a warning when used; it is also subject to removal in a future MySQL Cluster release.

  • ExecuteOnComputer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name[none]...
    Restart Type: S

    This refers to the Id set for one of the computers defined in a [computer] section of the config.ini file.

  • PortNumber

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned11860 - 64K
    Restart Type: N

    This is the port number on which the management server listens for configuration requests and management commands.

  • HostName

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: S

    Specifying this parameter defines the hostname of the computer on which the management node is to reside. To specify a hostname other than localhost, either this parameter or ExecuteOnComputer is required.

  • LogDestination

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0{CONSOLE|SYSLOG|FILE}[see text]...
    Restart Type: N

    This parameter specifies where to send cluster logging information. There are three options in this regard-CONSOLE, SYSLOG, and FILE-with FILE being the default:

    • CONSOLE outputs the log to stdout:

      CONSOLE
    • SYSLOG sends the log to a syslog facility, possible values being one of auth, authpriv, cron, daemon, ftp, kern, lpr, mail, news, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6, or local7.

      Note

      Not every facility is necessarily supported by every operating system.

      SYSLOG:facility=syslog
    • FILE pipes the cluster log output to a regular file on the same machine. The following values can be specified:

      • filename: The name of the log file.

        In MySQL Cluster NDB 7.2.6 and earlier, the log file's default name, used if FILE was specified without also setting filename, was logger.log. Beginning with MySQL Cluster NDB 7.2.7, the default log file name used in such cases is ndb_nodeid_cluster.log.

      • maxsize: The maximum size (in bytes) to which the file can grow before logging rolls over to a new file. When this occurs, the old log file is renamed by appending .N to the file name, where N is the next number not yet used with this name.

      • maxfiles: The maximum number of log files.

      FILE:filename=cluster.log,maxsize=1000000,maxfiles=6

      The default value for the FILE parameter is FILE:filename=ndb_node_id_cluster.log,maxsize=1000000,maxfiles=6, where node_id is the ID of the node.

    It is possible to specify multiple log destinations separated by semicolons as shown here:

    CONSOLE;SYSLOG:facility=local0;FILE:filename=/var/log/mgmd
  • ArbitrationRank

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.00-210 - 2
    Restart Type: N

    This parameter is used to define which nodes can act as arbitrators. Only management nodes and SQL nodes can be arbitrators. ArbitrationRank can take one of the following values:

    • 0: The node will never be used as an arbitrator.

    • 1: The node has high priority; that is, it will be preferred as an arbitrator over low-priority nodes.

    • 2: Indicates a low-priority node which be used as an arbitrator only if a node with a higher priority is not available for that purpose.

    Normally, the management server should be configured as an arbitrator by setting its ArbitrationRank to 1 (the default for management nodes) and those for all SQL nodes to 0 (the default for SQL nodes).

    You can disable arbitration completely either by setting ArbitrationRank to 0 on all management and SQL nodes, or by setting the Arbitration parameter in the [ndbd default] section of the config.ini global configuration file. Setting Arbitration causes any settings for ArbitrationRank to be disregarded.

  • ArbitrationDelay

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds00 - 4G
    Restart Type: N

    An integer value which causes the management server's responses to arbitration requests to be delayed by that number of milliseconds. By default, this value is 0; it is normally not necessary to change it.

  • DataDir

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0path....
    Restart Type: N

    This specifies the directory where output files from the management server will be placed. These files include cluster log files, process output files, and the daemon's process ID (PID) file. (For log files, this location can be overridden by setting the FILE parameter for LogDestination as discussed previously in this section.)

    The default value for this parameter is the directory in which ndb_mgmd is located.

  • HeartbeatThreadPriority

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.2string[none]...
    Restart Type: S

    Set the scheduling policy and priority of heartbeat threads for management and API nodes.

    The syntax for setting this parameter is shown here:

    HeartbeatThreadPriority = policy[, priority]policy:  {FIFO | RR}

    When setting this parameter, you must specify a policy. This is one of FIFO (first in, first out) or RR (round robin). The policy value is followed optionally by the priority (an integer).

  • TotalSendBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0bytes256K0 - 4G
    Restart Type: N

    This parameter is available beginning with MySQL Cluster NDB 6.4.0. It is used to determine the total amount of memory to allocate on this node for shared send buffer memory among all configured transporters.

    If this parameter is set, its minimum permitted value is 256KB; the maxmimum is 4294967039. For more detailed information about the behavior and use of TotalSendBufferMemory and configuring send buffer memory parameters, see Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters".

Note

After making changes in a management node's configuration, it is necessary to perform a rolling restart of the cluster for the new configuration to take effect.

To add new management servers to a running MySQL Cluster, it is also necessary to perform a rolling restart of all cluster nodes after modifying any existing config.ini files. For more information about issues arising when using multiple management nodes, see Section 17.1.6.10, "Limitations Relating to Multiple MySQL Cluster Nodes".

17.3.2.6. Defining MySQL Cluster Data Nodes

The [ndbd] and [ndbd default] sections are used to configure the behavior of the cluster's data nodes.

[ndbd] and [ndbd default] are always used as the section names whether you are using ndbd or ndbmtd binaries for the data node processes.

There are many parameters which control buffer sizes, pool sizes, timeouts, and so forth. The only mandatory parameter is either one of ExecuteOnComputer or HostName; this must be defined in the local [ndbd] section.

The parameter NoOfReplicas should be defined in the [ndbd default] section, as it is common to all Cluster data nodes. It is not strictly necessary to set NoOfReplicas, but it is good practice to set it explicitly.

Most data node parameters are set in the [ndbd default] section. Only those parameters explicitly stated as being able to set local values are permitted to be changed in the [ndbd] section. Where present, HostName, NodeId and ExecuteOnComputer must be defined in the local [ndbd] section, and not in any other section of config.ini. In other words, settings for these parameters are specific to one data node.

For those parameters affecting memory usage or buffer sizes, it is possible to use K, M, or G as a suffix to indicate units of 1024, 1024�1024, or 1024�1024�1024. (For example, 100K means 100 � 1024 = 102400.) Parameter names and values are currently case-sensitive.

Information about configuration parameters specific to MySQL Cluster Disk Data tables can be found later in this section (see Disk Data Configuration Parameters).

All of these parameters also apply to ndbmtd (the multi-threaded version of ndbd). Three additional data node configuration parameters-MaxNoOfExecutionThreads, ThreadConfig, and NoOfFragmentLogParts-apply to ndbmtd only; these have no effect when used with ndbd. For more information, see Multi-Threading Configuration Parameters (ndbmtd). See also Section 17.4.3, "ndbmtd - The MySQL Cluster Data Node Daemon (Multi-Threaded)".

Identifying data nodes. The NodeId or Id value (that is, the data node identifier) can be allocated on the command line when the node is started or in the configuration file.

  • Id

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]1 - 48
    Restart Type: N

    A unique node ID is used as the node's address for all cluster internal messages. For data nodes, this is an integer in the range 1 to 48 inclusive. Each node in the cluster must have a unique identifier.

    NodeId is the preferred parameter name to use when identifying data nodes. Although the older Id is still supported for backward compatibility, it is now deprecated, and generates a warning when used. Id is also subject to removal in a future MySQL Cluster release.

  • NodeId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]1 - 48
    Restart Type: N

    A unique node ID is used as the node's address for all cluster internal messages. For data nodes, this is an integer in the range 1 to 48 inclusive. Each node in the cluster must have a unique identifier.

    NodeId is the preferred parameter name to use when identifying data nodes. Although Id continues to be supported for backward compatibility, it is now deprecated, generates a warning when used, and is subject to removal in a future version of MySQL Cluster.

  • ExecuteOnComputer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name[none]...
    Restart Type: S

    This refers to the Id set for one of the computers defined in a [computer] section.

  • HostName

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP addresslocalhost...
    Restart Type: S

    Specifying this parameter defines the hostname of the computer on which the data node is to reside. To specify a hostname other than localhost, either this parameter or ExecuteOnComputer is required.

  • ServerPort

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]1 - 64K
    Restart Type: N

    Each node in the cluster uses a port to connect to other nodes. By default, this port is allocated dynamically in such a way as to ensure that no two nodes on the same host computer receive the same port number, so it should normally not be necessary to specify a value for this parameter.

    However, if you need to be able to open specific ports in a firewall to permit communication between data nodes and API nodes (including SQL nodes), you can set this parameter to the number of the desired port in an [ndbd] section or (if you need to do this for multiple data nodes) the [ndbd default] section of the config.ini file, and then open the port having that number for incoming connections from SQL nodes, API nodes, or both.

    Note

    Connections from data nodes to management nodes is done using the ndb_mgmd management port (the management server's PortNumber; see Section 17.3.2.5, "Defining a MySQL Cluster Management Server") so outgoing connections to that port from any data nodes should always be permitted.

  • TcpBind_INADDR_ANY

    Setting this parameter to TRUE or 1 binds IP_ADDR_ANY so that connections can be made from anywhere (for autogenerated connections). The default is FALSE (0).

  • NodeGroup

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0 [none]0 - 65536
    Restart Type: IS

    This parameter can be used to assign a data node to a specific node group. It is read only when the cluster is started for the first time, and cannot be used to reassign a data node to a different node group online. It is generally not desirable to use this parameter in the [ndbd default] section of the config.ini file, and care must be taken not to assign nodes to node groups in such a way that an invalid numbers of nodes are assigned to any node groups.

    The NodeGroup parameter is chiefly intended for use in adding a new node group to a running MySQL Cluster without having to perform a rolling restart. For this purpose, you should set it to 65536 (the maximum value). You are not required to set a NodeGroup value for all cluster data nodes, only for those nodes which are to be started and added to the cluster as a new node group at a later time. For more information, see Section 17.5.13.3, "Adding MySQL Cluster Data Nodes Online: Detailed Example".

  • NoOfReplicas

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.6integer21 - 4
    Restart Type: IS

    This global parameter can be set only in the [ndbd default] section, and defines the number of replicas for each table stored in the cluster. This parameter also specifies the size of node groups. A node group is a set of nodes all storing the same information.

    Node groups are formed implicitly. The first node group is formed by the set of data nodes with the lowest node IDs, the next node group by the set of the next lowest node identities, and so on. By way of example, assume that we have 4 data nodes and that NoOfReplicas is set to 2. The four data nodes have node IDs 2, 3, 4 and 5. Then the first node group is formed from nodes 2 and 3, and the second node group by nodes 4 and 5. It is important to configure the cluster in such a manner that nodes in the same node groups are not placed on the same computer because a single hardware failure would cause the entire cluster to fail.

    If no node IDs are provided, the order of the data nodes will be the determining factor for the node group. Whether or not explicit assignments are made, they can be viewed in the output of the management client's SHOW command.

    The default value for NoOfReplicas is 2, which is the recommended setting in most common usage scenarios.

    The maximum possible value is 4; currently, only the values 1 and 2 are actually supported.

    Important

    Setting NoOfReplicas to 1 means that there is only a single copy of all Cluster data; in this case, the loss of a single data node causes the cluster to fail because there are no additional copies of the data stored by that node.

    The value for this parameter must divide evenly into the number of data nodes in the cluster. For example, if there are two data nodes, then NoOfReplicas must be equal to either 1 or 2, since 2/3 and 2/4 both yield fractional values; if there are four data nodes, then NoOfReplicas must be equal to 1, 2, or 4.

  • DataDir

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0path....
    Restart Type: IN

    This parameter specifies the directory where trace files, log files, pid files and error logs are placed.

    The default is the data node process working directory.

  • FileSystemPath

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0pathDataDir...
    Restart Type: IN

    This parameter specifies the directory where all files created for metadata, REDO logs, UNDO logs (for Disk Data tables), and data files are placed. The default is the directory specified by DataDir.

    Note

    This directory must exist before the ndbd process is initiated.

    The recommended directory hierarchy for MySQL Cluster includes /var/lib/mysql-cluster, under which a directory for the node's file system is created. The name of this subdirectory contains the node ID. For example, if the node ID is 2, this subdirectory is named ndb_2_fs.

  • BackupDataDir

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0path[see text]...
    Restart Type: IN

    This parameter specifies the directory in which backups are placed.

    Important

    The string '/BACKUP' is always appended to this value. For example, if you set the value of BackupDataDir to /var/lib/cluster-data, then all backups are stored under /var/lib/cluster-data/BACKUP. This also means that the effective default backup location is the directory named BACKUP under the location specified by the FileSystemPath parameter.

Data Memory, Index Memory, and String Memory

DataMemory and IndexMemory are [ndbd] parameters specifying the size of memory segments used to store the actual records and their indexes. In setting values for these, it is important to understand how DataMemory and IndexMemory are used, as they usually need to be updated to reflect actual usage by the cluster:

  • DataMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes80M1M - 1024G
    Restart Type: N

    This parameter defines the amount of space (in bytes) available for storing database records. The entire amount specified by this value is allocated in memory, so it is extremely important that the machine has sufficient physical memory to accommodate it.

    The memory allocated by DataMemory is used to store both the actual records and indexes. There is a 16-byte overhead on each record; an additional amount for each record is incurred because it is stored in a 32KB page with 128 byte page overhead (see below). There is also a small amount wasted per page due to the fact that each record is stored in only one page.

    For variable-size table attributes, the data is stored on separate datapages, allocated from DataMemory. Variable-length records use a fixed-size part with an extra overhead of 4 bytes to reference the variable-size part. The variable-size part has 2 bytes overhead plus 2 bytes per attribute.

    The maximum record size is 14000 bytes.

    The memory space defined by DataMemory is also used to store ordered indexes, which use about 10 bytes per record. Each table row is represented in the ordered index. A common error among users is to assume that all indexes are stored in the memory allocated by IndexMemory, but this is not the case: Only primary key and unique hash indexes use this memory; ordered indexes use the memory allocated by DataMemory. However, creating a primary key or unique hash index also creates an ordered index on the same keys, unless you specify USING HASH in the index creation statement. This can be verified by running ndb_desc -d db_name table_name in the management client.

    Currently, MySQL Cluster can use a maximum of 512 MB for hash indexes per partition, which means in some cases it is possible to get Table is full errors in MySQL client applications even when ndb_mgm -e "ALL REPORT MEMORYUSAGE" shows significant free DataMemory. This can also pose a problem with data node restarts on nodes that are heavily loaded with data. You can force NDB to create extra partitions for MySQL Cluster tables and thus have more memory available for hash indexes by using the MAX_ROWS option for CREATE TABLE. In general, setting MAX_ROWS to twice the number of rows that you expect to store in the table should be sufficient. In MySQL Cluster 7.2.3 and later, you can also use the MinFreePct configuration parameter to help avoid problems with node restarts. (Bug #13436216)

    The memory space allocated by DataMemory consists of 32KB pages, which are allocated to table fragments. Each table is normally partitioned into the same number of fragments as there are data nodes in the cluster. Thus, for each node, there are the same number of fragments as are set in NoOfReplicas.

    Once a page has been allocated, it is currently not possible to return it to the pool of free pages, except by deleting the table. (This also means that DataMemory pages, once allocated to a given table, cannot be used by other tables.) Performing a data node recovery also compresses the partition because all records are inserted into empty partitions from other live nodes.

    The DataMemory memory space also contains UNDO information: For each update, a copy of the unaltered record is allocated in the DataMemory. There is also a reference to each copy in the ordered table indexes. Unique hash indexes are updated only when the unique index columns are updated, in which case a new entry in the index table is inserted and the old entry is deleted upon commit. For this reason, it is also necessary to allocate enough memory to handle the largest transactions performed by applications using the cluster. In any case, performing a few large transactions holds no advantage over using many smaller ones, for the following reasons:

    • Large transactions are not any faster than smaller ones

    • Large transactions increase the number of operations that are lost and must be repeated in event of transaction failure

    • Large transactions use more memory

    The default value for DataMemory is 80MB; the minimum is 1MB. There is no maximum size, but in reality the maximum size has to be adapted so that the process does not start swapping when the limit is reached. This limit is determined by the amount of physical RAM available on the machine and by the amount of memory that the operating system may commit to any one process. 32-bit operating systems are generally limited to 2�4GB per process; 64-bit operating systems can use more. For large databases, it may be preferable to use a 64-bit operating system for this reason.

  • IndexMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes18M1M - 1T
    Restart Type: N

    This parameter controls the amount of storage used for hash indexes in MySQL Cluster. Hash indexes are always used for primary key indexes, unique indexes, and unique constraints. Note that when defining a primary key and a unique index, two indexes will be created, one of which is a hash index used for all tuple accesses as well as lock handling. It is also used to enforce unique constraints.

    The size of the hash index is 25 bytes per record, plus the size of the primary key. For primary keys larger than 32 bytes another 8 bytes is added.

    The default value for IndexMemory is 18MB. The minimum is 1MB.

  • StringMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0% or bytes50 - 4G
    NDB 7.2.1% or bytes250 - 4G
    Restart Type: S

    This parameter determines how much memory is allocated for strings such as table names, and is specified in an [ndbd] or [ndbd default] section of the config.ini file. A value between 0 and 100 inclusive is interpreted as a percent of the maximum default value, which is calculated based on a number of factors including the number of tables, maximum table name size, maximum size of .FRM files, MaxNoOfTriggers, maximum column name size, and maximum default column value.

    A value greater than 100 is interpreted as a number of bytes.

    The default value is 25-that is, 25 percent of the default maximum.

    Under most circumstances, the default value should be sufficient, but when you have a great many Cluster tables (1000 or more), it is possible to get Error 773 Out of string memory, please modify StringMemory config parameter: Permanent error: Schema error, in which case you should increase this value. 25 (25 percent) is not excessive, and should prevent this error from recurring in all but the most extreme conditions.

The following example illustrates how memory is used for a table. Consider this table definition:

CREATE TABLE example (  a INT NOT NULL,  b INT NOT NULL,  c INT NOT NULL,  PRIMARY KEY(a),  UNIQUE(b)) ENGINE=NDBCLUSTER;

For each record, there are 12 bytes of data plus 12 bytes overhead. Having no nullable columns saves 4 bytes of overhead. In addition, we have two ordered indexes on columns a and b consuming roughly 10 bytes each per record. There is a primary key hash index on the base table using roughly 29 bytes per record. The unique constraint is implemented by a separate table with b as primary key and a as a column. This other table consumes an additional 29 bytes of index memory per record in the example table as well 8 bytes of record data plus 12 bytes of overhead.

Thus, for one million records, we need 58MB for index memory to handle the hash indexes for the primary key and the unique constraint. We also need 64MB for the records of the base table and the unique index table, plus the two ordered index tables.

You can see that hash indexes takes up a fair amount of memory space; however, they provide very fast access to the data in return. They are also used in MySQL Cluster to handle uniqueness constraints.

Currently, the only partitioning algorithm is hashing and ordered indexes are local to each node. Thus, ordered indexes cannot be used to handle uniqueness constraints in the general case.

An important point for both IndexMemory and DataMemory is that the total database size is the sum of all data memory and all index memory for each node group. Each node group is used to store replicated information, so if there are four nodes with two replicas, there will be two node groups. Thus, the total data memory available is 2 � DataMemory for each data node.

It is highly recommended that DataMemory and IndexMemory be set to the same values for all nodes. Data distribution is even over all nodes in the cluster, so the maximum amount of space available for any node can be no greater than that of the smallest node in the cluster.

DataMemory and IndexMemory can be changed, but decreasing either of these can be risky; doing so can easily lead to a node or even an entire MySQL Cluster that is unable to restart due to there being insufficient memory space. Increasing these values should be acceptable, but it is recommended that such upgrades are performed in the same manner as a software upgrade, beginning with an update of the configuration file, and then restarting the management server followed by restarting each data node in turn.

Beginning with MySQL Cluster NDB 7.2.3, a proportion (5% by default) of data node resources including DataMemory and IndexMemory is kept in reserve to insure that the data node does not exhaust its memory when performing a restart. This can be adjusted using the MinFreePct data node configuration parameter (default 5) introduced in the same version of MySQL Cluster.

Effective VersionType/UnitsDefaultRange or Permitted Values
NDB 7.1.18unsigned50 - 100
NDB 7.2.3unsigned50 - 100
Restart Type: N

Updates do not increase the amount of index memory used. Inserts take effect immediately; however, rows are not actually deleted until the transaction is committed.

Transaction parameters. The next few [ndbd] parameters that we discuss are important because they affect the number of parallel transactions and the sizes of transactions that can be handled by the system. MaxNoOfConcurrentTransactions sets the number of parallel transactions possible in a node. MaxNoOfConcurrentOperations sets the number of records that can be in update phase or locked simultaneously.

Both of these parameters (especially MaxNoOfConcurrentOperations) are likely targets for users setting specific values and not using the default value. The default value is set for systems using small transactions, to ensure that these do not use excessive memory.

MaxDMLOperationsPerTransaction sets the maximum number of DML operations that can be performed in a given transaction.

  • MaxNoOfConcurrentTransactions

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer409632 - 4G
    Restart Type: S

    Each cluster data node requires a transaction record for each active transaction in the cluster. The task of coordinating transactions is distributed among all of the data nodes. The total number of transaction records in the cluster is the number of transactions in any given node times the number of nodes in the cluster.

    Transaction records are allocated to individual MySQL servers. Each connection to a MySQL server requires at least one transaction record, plus an additional transaction object per table accessed by that connection. This means that a reasonable minimum for the total number of transactions in the cluster can be expressed as

    TotalNoOfConcurrentTransactions = (maximum number of tables accessed in any single transaction + 1) * number of cluster SQL nodes

    Suppose that there are 10 SQL nodes using the cluster. A single join involving 10 tables requires 11 transaction records; if there are 10 such joins in a transaction, then 10 * 11 = 110 transaction records are required for this transaction, per MySQL server, or 110 * 10 = 1100 transaction records total. Each data node can be expected to handle TotalNoOfConcurrentTransactions / number of data nodes. For a MySQL Cluster having 4 data nodes, this would mean setting MaxNoOfConcurrentTransactions on each data node to 1100 / 4 = 275. In addition, you should provide for failure recovery by insuring that a single node group can accommodate all concurrent transactions; in other words, that each data node's MaxNoOfConcurrentTransactions is sufficient to cover a number of transaction equal to TotalNoOfConcurrentTransactions / number of node groups. If this cluster has a single node group, then MaxNoOfConcurrentTransactions should be set to 1100 (the same as the total number of concurrent transactions for the entire cluster).

    In addition, each transaction involves at least one operation; for this reason, the value set for MaxNoOfConcurrentTransactions should always be no more than the value of MaxNoOfConcurrentOperations.

    This parameter must be set to the same value for all cluster data nodes. This is due to the fact that, when a data node fails, the oldest surviving node re-creates the transaction state of all transactions that were ongoing in the failed node.

    Changing the value of MaxNoOfConcurrentTransactions requires a complete shutdown and restart of the cluster.

    The default value is 4096.

  • MaxNoOfConcurrentOperations

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer32K32 - 4G
    Restart Type: N

    It is a good idea to adjust the value of this parameter according to the size and number of transactions. When performing transactions of only a few operations each and not involving a great many records, there is no need to set this parameter very high. When performing large transactions involving many records need to set this parameter higher.

    Records are kept for each transaction updating cluster data, both in the transaction coordinator and in the nodes where the actual updates are performed. These records contain state information needed to find UNDO records for rollback, lock queues, and other purposes.

    This parameter should be set at a minimum to the number of records to be updated simultaneously in transactions, divided by the number of cluster data nodes. For example, in a cluster which has four data nodes and which is expected to handle one million concurrent updates using transactions, you should set this value to 1000000 / 4 = 250000. To help provide resiliency against failures, it is suggested that you set this parameter to a value that is high enough to permit an individual data node to handle the load for its node group. In other words, you should set the value equal to total number of concurrent operations / number of node groups. (In the case where there is a single node group, this is the same as the total number of concurrent operations for the entire cluster.)

    Because each transaction always involves at least one operation, the value of MaxNoOfConcurrentOperations should always be greater than or equal to the value of MaxNoOfConcurrentTransactions.

    Read queries which set locks also cause operation records to be created. Some extra space is allocated within individual nodes to accommodate cases where the distribution is not perfect over the nodes.

    When queries make use of the unique hash index, there are actually two operation records used per record in the transaction. The first record represents the read in the index table and the second handles the operation on the base table.

    The default value is 32768.

    This parameter actually handles two values that can be configured separately. The first of these specifies how many operation records are to be placed with the transaction coordinator. The second part specifies how many operation records are to be local to the database.

    A very large transaction performed on an eight-node cluster requires as many operation records in the transaction coordinator as there are reads, updates, and deletes involved in the transaction. However, the operation records of the are spread over all eight nodes. Thus, if it is necessary to configure the system for one very large transaction, it is a good idea to configure the two parts separately. MaxNoOfConcurrentOperations will always be used to calculate the number of operation records in the transaction coordinator portion of the node.

    It is also important to have an idea of the memory requirements for operation records. These consume about 1KB per record.

  • MaxNoOfLocalOperations

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integerUNDEFINED32 - 4G
    Restart Type: N

    By default, this parameter is calculated as 1.1 � MaxNoOfConcurrentOperations. This fits systems with many simultaneous transactions, none of them being very large. If there is a need to handle one very large transaction at a time and there are many nodes, it is a good idea to override the default value by explicitly specifying this parameter.

  • MaxDMLOperationsPerTransaction

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.15operations (DML)429496729532 - 4294967295
    Restart Type: N

    This parameter limits the size of a transaction. The transaction is aborted if it requires more than this many DML operations. The minimum number of operations per transaction is 32; however, you can set MaxDMLOperationsPerTransaction to 0 to disable any limitation on the number of DML operations per transaction. The maximum (and default) is 4294967295.

Transaction temporary storage. The next set of [ndbd] parameters is used to determine temporary storage when executing a statement that is part of a Cluster transaction. All records are released when the statement is completed and the cluster is waiting for the commit or rollback.

The default values for these parameters are adequate for most situations. However, users with a need to support transactions involving large numbers of rows or operations may need to increase these values to enable better parallelism in the system, whereas users whose applications require relatively small transactions can decrease the values to save memory.

  • MaxNoOfConcurrentIndexOperations

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer8K0 - 4G
    Restart Type: N

    For queries using a unique hash index, another temporary set of operation records is used during a query's execution phase. This parameter sets the size of that pool of records. Thus, this record is allocated only while executing a part of a query. As soon as this part has been executed, the record is released. The state needed to handle aborts and commits is handled by the normal operation records, where the pool size is set by the parameter MaxNoOfConcurrentOperations.

    The default value of this parameter is 8192. Only in rare cases of extremely high parallelism using unique hash indexes should it be necessary to increase this value. Using a smaller value is possible and can save memory if the DBA is certain that a high degree of parallelism is not required for the cluster.

  • MaxNoOfFiredTriggers

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer40000 - 4G
    Restart Type: N

    The default value of MaxNoOfFiredTriggers is 4000, which is sufficient for most situations. In some cases it can even be decreased if the DBA feels certain the need for parallelism in the cluster is not high.

    A record is created when an operation is performed that affects a unique hash index. Inserting or deleting a record in a table with unique hash indexes or updating a column that is part of a unique hash index fires an insert or a delete in the index table. The resulting record is used to represent this index table operation while waiting for the original operation that fired it to complete. This operation is short-lived but can still require a large number of records in its pool for situations with many parallel write operations on a base table containing a set of unique hash indexes.

  • TransactionBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes1M1K - 4G
    Restart Type: N

    The memory affected by this parameter is used for tracking operations fired when updating index tables and reading unique indexes. This memory is used to store the key and column information for these operations. It is only very rarely that the value for this parameter needs to be altered from the default.

    The default value for TransactionBufferMemory is 1MB.

    Normal read and write operations use a similar buffer, whose usage is even more short-lived. The compile-time parameter ZATTRBUF_FILESIZE (found in ndb/src/kernel/blocks/Dbtc/Dbtc.hpp) set to 4000 � 128 bytes (500KB). A similar buffer for key information, ZDATABUF_FILESIZE (also in Dbtc.hpp) contains 4000 � 16 = 62.5KB of buffer space. Dbtc is the module that handles transaction coordination.

Scans and buffering. There are additional [ndbd] parameters in the Dblqh module (in ndb/src/kernel/blocks/Dblqh/Dblqh.hpp) that affect reads and updates. These include ZATTRINBUF_FILESIZE, set by default to 10000 � 128 bytes (1250KB) and ZDATABUF_FILE_SIZE, set by default to 10000*16 bytes (roughly 156KB) of buffer space. To date, there have been neither any reports from users nor any results from our own extensive tests suggesting that either of these compile-time limits should be increased.

  • MaxNoOfConcurrentScans

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer2562 - 500
    Restart Type: N

    This parameter is used to control the number of parallel scans that can be performed in the cluster. Each transaction coordinator can handle the number of parallel scans defined for this parameter. Each scan query is performed by scanning all partitions in parallel. Each partition scan uses a scan record in the node where the partition is located, the number of records being the value of this parameter times the number of nodes. The cluster should be able to sustain MaxNoOfConcurrentScans scans concurrently from all nodes in the cluster.

    Scans are actually performed in two cases. The first of these cases occurs when no hash or ordered indexes exists to handle the query, in which case the query is executed by performing a full table scan. The second case is encountered when there is no hash index to support the query but there is an ordered index. Using the ordered index means executing a parallel range scan. The order is kept on the local partitions only, so it is necessary to perform the index scan on all partitions.

    The default value of MaxNoOfConcurrentScans is 256. The maximum value is 500.

  • MaxNoOfLocalScans

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integerUNDEFINED32 - 4G
    Restart Type: N

    Specifies the number of local scan records if many scans are not fully parallelized. In MySQL Cluster NDB 7.2.0 and later, when the number of local scan records is not provided, it is calculated as 4 times the product of MaxNoOfConcurrentScans and the number of data nodes in the system. (Previously, it was calculated as the product of MaxNoOfConcurrentScans and the number of data nodes.) The minimum value is 32.

  • BatchSizePerLocalScan

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer641 - 992
    NDB 7.2.1integer2561 - 992
    Restart Type: N

    This parameter is used to calculate the number of lock records used to handle concurrent scan operations.

    BatchSizePerLocalScan has a strong connection to the BatchSize defined in the SQL nodes.

  • LongMessageBuffer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes4M512K - 4G
    Restart Type: N

    This is an internal buffer used for passing messages within individual nodes and between nodes. The default is 4MB.

    This parameter seldom needs to be changed from the default.

  • MaxParallelScansPerFragment

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes2561 - 1G
    Restart Type: N

    It is possible to configure the maximum number of parallel scans (TUP scans and TUX scans) allowed before they begin queuing for serial handling. You can increase this to take advantage of any unused CPU when performing large number of scans in parallel and improve their performance.

    Beginning with MySQL Cluster NDB 7.2.0, the default value for this parameter was increased from 32 to 256.

Memory Allocation

MaxAllocate

Effective VersionType/UnitsDefaultRange or Permitted Values
NDB 7.2.0unsigned32M1M - 1G
Restart Type: N

This is the maximum size of the memory unit to use when allocating memory for tables. In cases where NDB gives Out of memory errors, but it is evident by examining the cluster logs or the output of DUMP 1000 (see DUMP 1000) that all available memory has not yet been used, you can increase the value of this parameter (or MaxNoOfTables, or both) to cause NDB to make sufficient memory available.

Logging and checkpointing. The following [ndbd] parameters control log and checkpoint behavior.

  • NoOfFragmentLogFiles

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer163 - 4G
    Restart Type: IN

    This parameter sets the number of REDO log files for the node, and thus the amount of space allocated to REDO logging. Because the REDO log files are organized in a ring, it is extremely important that the first and last log files in the set (sometimes referred to as the "head" and "tail" log files, respectively) do not meet. When these approach one another too closely, the node begins aborting all transactions encompassing updates due to a lack of room for new log records.

    A REDO log record is not removed until the required number of local checkpoints has been completed since that log record was inserted. (In MySQL Cluster NDB 7.2, only 2 local checkpoints are necessary). Checkpointing frequency is determined by its own set of configuration parameters discussed elsewhere in this chapter.

    The default parameter value is 16, which by default means 16 sets of 4 16MB files for a total of 1024MB. The size of the individual log files is configurable using the FragmentLogFileSize parameter. In scenarios requiring a great many updates, the value for NoOfFragmentLogFiles may need to be set as high as 300 or even higher to provide sufficient space for REDO logs.

    If the checkpointing is slow and there are so many writes to the database that the log files are full and the log tail cannot be cut without jeopardizing recovery, all updating transactions are aborted with internal error code 410 (Out of log file space temporarily). This condition prevails until a checkpoint has completed and the log tail can be moved forward.

    Important

    This parameter cannot be changed "on the fly"; you must restart the node using --initial. If you wish to change this value for all data nodes in a running cluster, you can do so using a rolling node restart (using --initial when starting each data node).

  • FragmentLogFileSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.1.11bytes16M4M - 1G
    Restart Type: IN

    Setting this parameter enables you to control directly the size of redo log files. This can be useful in situations when MySQL Cluster is operating under a high load and it is unable to close fragment log files quickly enough before attempting to open new ones (only 2 fragment log files can be open at one time); increasing the size of the fragment log files gives the cluster more time before having to open each new fragment log file. The default value for this parameter is 16M.

    For more information about fragment log files, see the description for NoOfFragmentLogFiles.

  • InitFragmentLogFiles

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.19[see values]SPARSESPARSE, FULL
    Restart Type: IN

    By default, fragment log files are created sparsely when performing an initial start of a data node-that is, depending on the operating system and file system in use, not all bytes are necessarily written to disk. However, it is possible to override this behavior and force all bytes to be written, regardless of the platform and file system type being used, by means of this parameter. InitFragmentLogFiles takes either of two values:

    • SPARSE. Fragment log files are created sparsely. This is the default value.

    • FULL. Force all bytes of the fragment log file to be written to disk.

    Depending on your operating system and file system, setting InitFragmentLogFiles=FULL may help eliminate I/O errors on writes to the REDO log.

  • MaxNoOfOpenFiles

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned020 - 4G
    Restart Type: N

    This parameter sets a ceiling on how many internal threads to allocate for open files. Any situation requiring a change in this parameter should be reported as a bug.

    The default value is 0. However, the minimum value to which this parameter can be set is 20.

  • InitialNoOfOpenFiles

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0files2720 - 4G
    Restart Type: N

    This parameter sets the initial number of internal threads to allocate for open files.

    The default value is 27.

  • MaxNoOfSavedMessages

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer250 - 4G
    Restart Type: N

    This parameter sets the maximum number of trace files that are kept before overwriting old ones. Trace files are generated when, for whatever reason, the node crashes.

    The default is 25 trace files.

  • MaxLCPStartDelay

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.3seconds00 - 600
    Restart Type: N

    In parallel data node recovery, only table data is actually copied and synchronized in parallel; synchronization of metadata such as dictionary and checkpoint information is done in a serial fashion. In addition, recovery of dictionary and checkpoint information cannot be executed in parallel with performing of local checkpoints. This means that, when starting or restarting many data nodes concurrently, data nodes may be forced to wait while a local checkpoint is performed, which can result in longer node recovery times.

    It is possible to force a delay in the local checkpoint to permit more (and possibly all) data nodes to complete metadata synchronization; once each data node's metadata synchronization is complete, all of the data nodes can recover table data in parallel, even while the local checkpoint is being executed. To force such a delay, set MaxLCPStartDelay, which determines the number of seconds the cluster can wait to begin a local checkpoint while data nodes continue to synchronize metadata. This parameter should be set in the [ndbd default] section of the config.ini file, so that it is the same for all data nodes. The maximum value is 600; the default is 0.

Metadata objects. The next set of [ndbd] parameters defines pool sizes for metadata objects, used to define the maximum number of attributes, tables, indexes, and trigger objects used by indexes, events, and replication between clusters. Note that these act merely as "suggestions" to the cluster, and any that are not specified revert to the default values shown.

  • MaxNoOfAttributes

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer100032 - 4G
    Restart Type: N

    This parameter sets a suggested maximum number of attributes that can be defined in the cluster; like MaxNoOfTables, it is not intended to function as a hard upper limit.

    (In older MySQL Cluster releases, this parameter was sometimes treated as a hard limit for certain operations. This caused problems with MySQL Cluster Replication, when it was possible to create more tables than could be replicated, and sometimes led to confusion when it was possible [or not possible, depending on the circumstances] to create more than MaxNoOfAttributes attributes.)

    The default value is 1000, with the minimum possible value being 32. The maximum is 4294967039. Each attribute consumes around 200 bytes of storage per node due to the fact that all metadata is fully replicated on the servers.

    When setting MaxNoOfAttributes, it is important to prepare in advance for any ALTER TABLE statements that you might want to perform in the future. This is due to the fact, during the execution of ALTER TABLE on a Cluster table, 3 times the number of attributes as in the original table are used, and a good practice is to permit double this amount. For example, if the MySQL Cluster table having the greatest number of attributes (greatest_number_of_attributes) has 100 attributes, a good starting point for the value of MaxNoOfAttributes would be 6 * greatest_number_of_attributes = 600.

    You should also estimate the average number of attributes per table and multiply this by MaxNoOfTables. If this value is larger than the value obtained in the previous paragraph, you should use the larger value instead.

    Assuming that you can create all desired tables without any problems, you should also verify that this number is sufficient by trying an actual ALTER TABLE after configuring the parameter. If this is not successful, increase MaxNoOfAttributes by another multiple of MaxNoOfTables and test it again.

  • MaxNoOfTables

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer1288 - 20320
    Restart Type: N

    A table object is allocated for each table and for each unique hash index in the cluster. This parameter sets a suggested maximum number of table objects for the cluster as a whole; like MaxNoOfAttributes, it is not intended to function as a hard upper limit.

    (In older MySQL Cluster releases, this parameter was sometimes treated as a hard limit for certain operations. This caused problems with MySQL Cluster Replication, when it was possible to create more tables than could be replicated, and sometimes led to confusion when it was possible [or not possible, depending on the circumstances] to create more than MaxNoOfTables tables.)

    For each attribute that has a BLOB data type an extra table is used to store most of the BLOB data. These tables also must be taken into account when defining the total number of tables.

    The default value of this parameter is 128. The minimum is 8 and the maximum is 20320. Each table object consumes approximately 20KB per node.

    Note

    The sum of MaxNoOfTables, MaxNoOfOrderedIndexes, and MaxNoOfUniqueHashIndexes must not exceed 232 � 2 (4294967294).

  • MaxNoOfOrderedIndexes

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer1280 - 4G
    Restart Type: N

    For each ordered index in the cluster, an object is allocated describing what is being indexed and its storage segments. By default, each index so defined also defines an ordered index. Each unique index and primary key has both an ordered index and a hash index. MaxNoOfOrderedIndexes sets the total number of ordered indexes that can be in use in the system at any one time.

    The default value of this parameter is 128. Each index object consumes approximately 10KB of data per node.

    Note

    The sum of MaxNoOfTables, MaxNoOfOrderedIndexes, and MaxNoOfUniqueHashIndexes must not exceed 232 � 2 (4294967294).

  • MaxNoOfUniqueHashIndexes

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer640 - 4G
    Restart Type: N

    For each unique index that is not a primary key, a special table is allocated that maps the unique key to the primary key of the indexed table. By default, an ordered index is also defined for each unique index. To prevent this, you must specify the USING HASH option when defining the unique index.

    The default value is 64. Each index consumes approximately 15KB per node.

    Note

    The sum of MaxNoOfTables, MaxNoOfOrderedIndexes, and MaxNoOfUniqueHashIndexes must not exceed 232 � 2 (4294967294).

  • MaxNoOfTriggers

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer7680 - 4G
    Restart Type: N

    Internal update, insert, and delete triggers are allocated for each unique hash index. (This means that three triggers are created for each unique hash index.) However, an ordered index requires only a single trigger object. Backups also use three trigger objects for each normal table in the cluster.

    Replication between clusters also makes use of internal triggers.

    This parameter sets the maximum number of trigger objects in the cluster.

    The default value is 768.

  • MaxNoOfIndexes

    This parameter is deprecated and subject to removal in a future version of MySQL Cluster. You should use MaxNoOfOrderedIndexes and MaxNoOfUniqueHashIndexes instead.

    This parameter is used only by unique hash indexes. There needs to be one record in this pool for each unique hash index defined in the cluster.

    The default value of this parameter is 128.

  • MaxNoOfSubscriptions

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.7unsigned00 - 4G
    Restart Type: N

    Each NDB table in a MySQL Cluster requires a subscription in the NDB kernel. For some NDB API applications, it may be necessary or desirable to change this paramete. However, for normal usage with MySQL servers acting as SQL nodes, there is not any need to do so.

    The default value for MaxNoOfSubscriptions is 0, which is treated as equal to MaxNoOfTables. Each subscription consumes 108 bytes.

  • MaxNoOfSubscribers

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.7unsigned00 - 4G
    Restart Type: N

    This parameter is of interest only when using MySQL Cluster Replication. The default value is 0, which is treated as 2 * MaxNoOfTables; that is, there is one subscription per NDB table for each of two MySQL servers (one acting as the replication master and the other as the slave). Each subscriber uses 16 bytes of memory.

    When using circular replication, multi-master replication, and other replication setups involving more than 2 MySQL servers, you should increase this parameter to the number of mysqld processes included in replication (this is often, but not always, the same as the number of clusters). For example, if you have a circular replication setup using three MySQL Clusters, with one mysqld attached to each cluster, and each of these mysqld processes acts as a master and as a slave, you should set MaxNoOfSubscribers equal to 3 * MaxNoOfTables.

    For more information, see Section 17.6, "MySQL Cluster Replication".

  • MaxNoOfConcurrentSubOperations

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.7unsigned2560 - 4G
    Restart Type: N

    This parameter sets a ceiling on the number of operations that can be performed by all API nodes in the cluster at one time. The default value (256) is sufficient for normal operations, and might need to be adjusted only in scenarios where there are a great many API nodes each performing a high volume of operations concurrently.

Boolean parameters. The behavior of data nodes is also affected by a set of [ndbd] parameters taking on boolean values. These parameters can each be specified as TRUE by setting them equal to 1 or Y, and as FALSE by setting them equal to 0 or N.

  • LockPagesInMainMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric00 - 2
    Restart Type: N

    For a number of operating systems, including Solaris and Linux, it is possible to lock a process into memory and so avoid any swapping to disk. This can be used to help guarantee the cluster's real-time characteristics.

    This parameter takes one of the integer values 0, 1, or 2, which act as shown in the following list:

    • 0: Disables locking. This is the default value.

    • 1: Performs the lock after allocating memory for the process.

    • 2: Performs the lock before memory for the process is allocated.

    If the operating system is not configured to permit unprivileged users to lock pages, then the data node process making use of this parameter may have to be run as system root. (LockPagesInMainMemory uses the mlockall function. From Linux kernel 2.6.9, unprivileged users can lock memory as limited by max locked memory. For more information, see ulimit -l and http://linux.die.net/man/2/mlock).

    Note

    In older MySQL Cluster releases, this parameter was a Boolean. 0 or false was the default setting, and disabled locking. 1 or true enabled locking of the process after its memory was allocated. In MySQL Cluster NDB 7.2, using true or false as the value of this parameter causes an error.

    Important

    Beginning with glibc 2.10, glibc uses per-thread arenas to reduce lock contention on a shared pool, which consumes real memory. In general, a data node process does not need per-thread arenas, since it does not perform any memory allocation after startup. (This difference in allocators does not appear to affect performance significantly.)

    The glibc behavior is intended to be configurable via the MALLOC_ARENA_MAX environment variable, but a bug in this this mechanism prior to glibc 2.16 meant that this variable could not be set to less than 8, so that the wasted memory could not be reclaimed. (Bug #15907219; see also http://sourceware.org/bugzilla/show_bug.cgi?id=13137 for more information concerning this issue.)

    One possible workaround for this problem is to use the LD_PRELOAD environment variable to preload a jemalloc memory allocation library to take the place of that supplied with glibc.

  • StopOnError

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0booleantruetrue, false
    Restart Type: N

    This parameter specifies whether a data node process should exit or perform an automatic restart when an error condition is encountered.

    This feature is enabled by default.

  • CrashOnCorruptedTuple

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.28, 5.1.56-ndb-7.1.17booleanfalsetrue, false
    NDB 7.2.1booleantruetrue, false
    Restart Type: S

    When this parameter is enabled, it forces a data node to shut down whenever it encounters a corrupted tuple. In MySQL Cluster NDB 7.2.1 and later, it is enabled by default. This is a change from MySQL Cluster NDB 7.0 and MySQL Cluster NDB 7.1, where it was disabled by default.

  • Diskless

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0true|false (1|0)falsetrue, false
    Restart Type: IS

    It is possible to specify MySQL Cluster tables as diskless, meaning that tables are not checkpointed to disk and that no logging occurs. Such tables exist only in main memory. A consequence of using diskless tables is that neither the tables nor the records in those tables survive a crash. However, when operating in diskless mode, it is possible to run ndbd on a diskless computer.

    Important

    This feature causes the entire cluster to operate in diskless mode.

    When this feature is enabled, Cluster online backup is disabled. In addition, a partial start of the cluster is not possible.

    Diskless is disabled by default.

  • ODirect

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.0booleanfalsetrue, false
    Restart Type: N

    Enabling this parameter causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often lowering kswapd and CPU usage. When using MySQL Cluster on Linux, enable ODirect if you are using a 2.6 or later kernel.

    ODirect is disabled by default.

  • RestartOnErrorInsert

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0error code20 - 4
    Restart Type: N

    This feature is accessible only when building the debug version where it is possible to insert errors in the execution of individual blocks of code as part of testing.

    This feature is disabled by default.

  • CompressedBackup

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.7booleanfalsetrue, false
    Restart Type: N

    Setting this parameter to 1 causes backup files to be compressed. The compression used is equivalent to gzip --fast, and can save 50% or more of the space required on the data node to store uncompressed backup files. Compressed backups can be enabled for individual data nodes, or for all data nodes (by setting this parameter in the [ndbd default] section of the config.ini file).

    Important

    You cannot restore a compressed backup to a cluster running a MySQL version that does not support this feature.

    The default value is 0 (disabled).

  • CompressedLCP

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.7booleanfalsetrue, false
    Restart Type: N

    Setting this parameter to 1 causes local checkpoint files to be compressed. The compression used is equivalent to gzip --fast, and can save 50% or more of the space required on the data node to store uncompressed checkpoint files. Compressed LCPs can be enabled for individual data nodes, or for all data nodes (by setting this parameter in the [ndbd default] section of the config.ini file).

    Important

    You cannot restore a compressed local checkpoint to a cluster running a MySQL version that does not support this feature.

    The default value is 0 (disabled).

Controlling Timeouts, Intervals, and Disk Paging

There are a number of [ndbd] parameters specifying timeouts and intervals between various actions in Cluster data nodes. Most of the timeout values are specified in milliseconds. Any exceptions to this are mentioned where applicable.

  • TimeBetweenWatchDogCheck

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds600070 - 4G
    Restart Type: N

    To prevent the main thread from getting stuck in an endless loop at some point, a "watchdog" thread checks the main thread. This parameter specifies the number of milliseconds between checks. If the process remains in the same state after three checks, the watchdog thread terminates it.

    This parameter can easily be changed for purposes of experimentation or to adapt to local conditions. It can be specified on a per-node basis although there seems to be little reason for doing so.

    The default timeout is 6000 milliseconds (6 seconds).

  • TimeBetweenWatchDogCheckInitial

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds600070 - 4G
    Restart Type: N

    This is similar to the TimeBetweenWatchDogCheck parameter, except that TimeBetweenWatchDogCheckInitial controls the amount of time that passes between execution checks inside a database node in the early start phases during which memory is allocated.

    The default timeout is 6000 milliseconds (6 seconds).

  • StartPartialTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds300000 - 4G
    Restart Type: N

    This parameter specifies how long the Cluster waits for all data nodes to come up before the cluster initialization routine is invoked. This timeout is used to avoid a partial Cluster startup whenever possible.

    This parameter is overridden when performing an initial start or initial restart of the cluster.

    The default value is 30000 milliseconds (30 seconds). 0 disables the timeout, in which case the cluster may start only if all nodes are available.

  • StartPartitionedTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds600000 - 4G
    Restart Type: N

    If the cluster is ready to start after waiting for StartPartialTimeout milliseconds but is still possibly in a partitioned state, the cluster waits until this timeout has also passed. If StartPartitionedTimeout is set to 0, the cluster waits indefinitely.

    This parameter is overridden when performing an initial start or initial restart of the cluster.

    The default timeout is 60000 milliseconds (60 seconds).

  • StartFailureTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds00 - 4G
    Restart Type: N

    If a data node has not completed its startup sequence within the time specified by this parameter, the node startup fails. Setting this parameter to 0 (the default value) means that no data node timeout is applied.

    For nonzero values, this parameter is measured in milliseconds. For data nodes containing extremely large amounts of data, this parameter should be increased. For example, in the case of a data node containing several gigabytes of data, a period as long as 10�15 minutes (that is, 600000 to 1000000 milliseconds) might be required to perform a node restart.

  • StartNoNodeGroupTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.24milliseconds150000 - 4294967039
    Restart Type: N

    When a data node is configured with Nodegroup = 65536, is regarded as not being assigned to any node group. When that is done, the cluster waits StartNoNodegroupTimeout milliseconds, then treats such nodes as though they had been added to the list passed to the --nowait-nodes option, and starts. The default value is 15000 (that is, the management server waits 15 seconds). Setting this parameter equal to 0 means that the cluster waits indefinitely.

    StartNoNodegroupTimeout must be the same for all data nodes in the cluster; for this reason, you should always set it in the [ndbd default] section of the config.ini file, rather than for individual data nodes.

    See Section 17.5.13, "Adding MySQL Cluster Data Nodes Online", for more information.

  • HeartbeatIntervalDbDb

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds500010 - 4G
    Restart Type: N

    One of the primary methods of discovering failed nodes is by the use of heartbeats. This parameter states how often heartbeat signals are sent and how often to expect to receive them. After missing three heartbeat intervals in a row, the node is declared dead. Thus, the maximum time for discovering a failure through the heartbeat mechanism is four times the heartbeat interval.

    In MySQL Cluster NDB 7.2.0 and later, the default heartbeat interval is 5000 milliseconds (5 seconds). (Previously, the default was 1500 milliseconds [1.5 seconds]). This parameter must not be changed drastically and should not vary widely between nodes. If one node uses 5000 milliseconds and the node watching it uses 1000 milliseconds, obviously the node will be declared dead very quickly. This parameter can be changed during an online software upgrade, but only in small increments.

    See also Network communication and latency.

  • HeartbeatIntervalDbApi

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds1500100 - 4G
    Restart Type: N

    Each data node sends heartbeat signals to each MySQL server (SQL node) to ensure that it remains in contact. If a MySQL server fails to send a heartbeat in time it is declared "dead," in which case all ongoing transactions are completed and all resources released. The SQL node cannot reconnect until all activities initiated by the previous MySQL instance have been completed. The three-heartbeat criteria for this determination are the same as described for HeartbeatIntervalDbDb.

    The default interval is 1500 milliseconds (1.5 seconds). This interval can vary between individual data nodes because each data node watches the MySQL servers connected to it, independently of all other data nodes.

    For more information, see Network communication and latency.

  • HeartbeatOrder

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.5numeric00 - 65535
    Restart Type: S

    Data nodes send heartbeats to one another in a circular fashion whereby each data node monitors the previous one. If a heartbeat is not detected by a given data node, this node declares the previous data node in the circle "dead" (that is, no longer accessible by the cluster). The determination that a data node is dead is done globally; in other words; once a data node is declared dead, it is regarded as such by all nodes in the cluster.

    It is possible for heartbeats between data nodes residing on different hosts to be too slow compared to heartbeats between other pairs of nodes (for example, due to a very low heartbeat interval or temporary connection problem), such that a data node is declared dead, even though the node can still function as part of the cluster. .

    In this type of situation, it may be that the order in which heartbeats are transmitted between data nodes makes a difference as to whether or not a particular data node is declared dead. If this declaration occurs unnecessarily, this can in turn lead to the unnecessary loss of a node group and as thus to a failure of the cluster.

    Consider a setup where there are 4 data nodes A, B, C, and D running on 2 host computers host1 and host2, and that these data nodes make up 2 node groups, as shown in the following table:

     host1host2
    Node Group 0:Node ANode B
    Node Group 1:Node CNode D

    Suppose the heartbeats are transmitted in the order A->B->C->D->A. In this case, the loss of the heartbeat between the hosts causes node B to declare node A dead and node C to declare node B dead. This results in loss of Node Group 0, and so the cluster fails. On the other hand, if the order of transmission is A->B->D->C->A (and all other conditions remain as previously stated), the loss of the heartbeat causes nodes A and D to be declared dead; in this case, each node group has one surviving node, and the cluster survives.

    The HeartbeatOrder configuration parameter makes the order of heartbeat transmission user-configurable. The default value for HeartbeatOrder is zero; allowing the default value to be used on all data nodes causes the order of heartbeat transmission to be determined by NDB. If this parameter is used, it must be set to a nonzero value (maximum 65535) for every data node in the cluster, and this value must be unique for each data node; this causes the heartbeat transmission to proceed from data node to data node in the order of their HeartbeatOrder values from lowest to highest (and then directly from the data node having the highest HeartbeatOrder to the data node having the lowest value, to complete the circle). The values need not be consecutive; for example, to force the heartbeat transmission order A->B->D->C->A in the scenario outlined previously, you could set the HeartbeatOrder values as shown here:

    NodeHeartbeatOrder
    A10
    B20
    C30
    D25

    To use this parameter to change the heartbeat transmission order in a running MySQL Cluster, you must first set HeartbeatOrder for each data node in the cluster in the global configuration (config.ini) file (or files). To cause the change to take effect, you must perform either of the following:

    • A complete shutdown and restart of the entire cluster.

    • 2 rolling restarts of the cluster in succession. All nodes must be restarted in the same order in both rolling restarts.

    You can use DUMP 908 to observe the effect of this parameter in the data node logs.

  • ConnectCheckIntervalDelay

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.13string15000 - 4G
    NDB 7.2.1string00 - 4G
    Restart Type: N

    This parameter enables connection checking between data nodes. A data node that fails to respond within an interval of ConnectCheckIntervalDelay seconds is considered suspect, and is considered dead after two such intervals.

    The default value for this parameter is 0; this is a change from MySQL Cluster NDB 7.1.

  • TimeBetweenLocalCheckpoints

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0number of 4-byte words, as a base-2 logarithm200 - 31
    Restart Type: N

    This parameter is an exception in that it does not specify a time to wait before starting a new local checkpoint; rather, it is used to ensure that local checkpoints are not performed in a cluster where relatively few updates are taking place. In most clusters with high update rates, it is likely that a new local checkpoint is started immediately after the previous one has been completed.

    The size of all write operations executed since the start of the previous local checkpoints is added. This parameter is also exceptional in that it is specified as the base-2 logarithm of the number of 4-byte words, so that the default value 20 means 4MB (4 � 220) of write operations, 21 would mean 8MB, and so on up to a maximum value of 31, which equates to 8GB of write operations.

    All the write operations in the cluster are added together. Setting TimeBetweenLocalCheckpoints to 6 or less means that local checkpoints will be executed continuously without pause, independent of the cluster's workload.

  • TimeBetweenGlobalCheckpoints

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.2.0milliseconds200020 - 32000
    Restart Type: N

    When a transaction is committed, it is committed in main memory in all nodes on which the data is mirrored. However, transaction log records are not flushed to disk as part of the commit. The reasoning behind this behavior is that having the transaction safely committed on at least two autonomous host machines should meet reasonable standards for durability.

    It is also important to ensure that even the worst of cases-a complete crash of the cluster-is handled properly. To guarantee that this happens, all transactions taking place within a given interval are put into a global checkpoint, which can be thought of as a set of committed transactions that has been flushed to disk. In other words, as part of the commit process, a transaction is placed in a global checkpoint group. Later, this group's log records are flushed to disk, and then the entire group of transactions is safely committed to disk on all computers in the cluster.

    This parameter defines the interval between global checkpoints. The default is 2000 milliseconds.

  • TimeBetweenEpochs

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.2.5milliseconds1000 - 32000
    Restart Type: N

    This parameter defines the interval between synchronization epochs for MySQL Cluster Replication. The default value is 100 milliseconds.

    TimeBetweenEpochs is part of the implementation of "micro-GCPs", which can be used to improve the performance of MySQL Cluster Replication.

  • TimeBetweenEpochsTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds40000 - 256000
    Restart Type: N

    This parameter defines a timeout for synchronization epochs for MySQL Cluster Replication. If a node fails to participate in a global checkpoint within the time determined by this parameter, the node is shut down. In MySQL Cluster NDB 7.2.0 and later, the default value is 0; in other words, the timeout is disabled. This represents a change from previous versions of MySQL Cluster, in which the default value was 4000 milliseconds (4 seconds).

    TimeBetweenEpochsTimeout is part of the implementation of "micro-GCPs", which can be used to improve the performance of MySQL Cluster Replication.

    The current value of this parameter and a warning are written to the cluster log whenever a GCP save takes longer than 1 minute or a GCP save takes longer than 10 seconds.

    Setting this parameter to zero has the effect of disabling GCP stops caused by save timeouts, commit timeouts, or both. The maximum possible value for this parameter is 256000 milliseconds.

  • MaxBufferedEpochs

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.2.14epochs1000 - 100000
    Restart Type: N

    The number of unprocessed epochs by which a subscribing node can lag behind. Exceeding this number causes a lagging subscriber to be disconnected.

    The default value of 100 is sufficient for most normal operations. If a subscribing node does lag enough to cause disconnections, it is usually due to network or scheduling issues with regard to processes or threads. (In rare circumstances, the problem may be due to a bug in the NDB client.) It may be desirable to set the value lower than the default when epochs are longer.

    Disconnection prevents client issues from affecting the data node service, running out of memory to buffer data, and eventually shutting down. Instead, only the client is affected as a result of the disconnect (by, for example gap events in the binary log), forcing the client to reconnect or restart the process.

  • TimeBetweenInactiveTransactionAbortCheck

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds10001000 - 4G
    Restart Type: N

    Timeout handling is performed by checking a timer on each transaction once for every interval specified by this parameter. Thus, if this parameter is set to 1000 milliseconds, every transaction will be checked for timing out once per second.

    The default value is 1000 milliseconds (1 second).

  • TransactionInactiveTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds4G0 - 4G
    Restart Type: N

    This parameter states the maximum time that is permitted to lapse between operations in the same transaction before the transaction is aborted.

    The default for this parameter is 4G (also the maximum). For a real-time database that needs to ensure that no transaction keeps locks for too long, this parameter should be set to a relatively small value. The unit is milliseconds.

  • TransactionDeadlockDetectionTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds120050 - 4G
    Restart Type: N

    When a node executes a query involving a transaction, the node waits for the other nodes in the cluster to respond before continuing. A failure to respond can occur for any of the following reasons:

    • The node is "dead"

    • The operation has entered a lock queue

    • The node requested to perform the action could be heavily overloaded.

    This timeout parameter states how long the transaction coordinator waits for query execution by another node before aborting the transaction, and is important for both node failure handling and deadlock detection.

    The default timeout value is 1200 milliseconds (1.2 seconds).

    The minimum for this parameter is 50 milliseconds.

  • DiskSyncSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes4M32K - 4G
    Restart Type: N

    This is the maximum number of bytes to store before flushing data to a local checkpoint file. This is done to prevent write buffering, which can impede performance significantly. This parameter is not intended to take the place of TimeBetweenLocalCheckpoints.

    Note

    When ODirect is enabled, it is not necessary to set DiskSyncSize; in fact, in such cases its value is simply ignored.

    The default value is 4M (4 megabytes).

  • DiskCheckpointSpeed

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes10M1M - 4G
    Restart Type: N

    The amount of data,in bytes per second, that is sent to disk during a local checkpoint. This allocation is shared by DML operations and backups (but not backup logging), which means that backups started during times of intensive DML may be impaired by flooding of the redo log buffer and may fail altogether if the contention is sufficiently severe.

    The default value is 10M (10 megabytes per second).

  • DiskCheckpointSpeedInRestart

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes100M1M - 4G
    Restart Type: N

    The amount of data,in bytes per second, that is sent to disk during a local checkpoint as part of a restart operation.

    The default value is 100M (100 megabytes per second).

  • NoOfDiskPagesToDiskAfterRestartTUP

    This parameter is deprecated and subject to removal in a future version of MySQL Cluster. Use DiskCheckpointSpeedInRestart and DiskSyncSize instead.

  • NoOfDiskPagesToDiskAfterRestartACC

    This parameter is deprecated and subject to removal in a future version of MySQL Cluster. Use DiskCheckpointSpeedInRestart and DiskSyncSize instead.

  • NoOfDiskPagesToDiskDuringRestartTUP (DEPRECATED)

    This parameter is deprecated and subject to removal in a future version of MySQL Cluster. Use DiskCheckpointSpeedInRestart and DiskSyncSize instead.

  • NoOfDiskPagesToDiskDuringRestartACC (DEPRECATED)

    This parameter is deprecated and subject to removal in a future version of MySQL Cluster. Use DiskCheckpointSpeedInRestart and DiskSyncSize instead.

  • ArbitrationTimeout

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds750010 - 4G
    Restart Type: N

    This parameter specifies how long data nodes wait for a response from the arbitrator to an arbitration message. If this is exceeded, the network is assumed to have split.

    In MySQL Cluster NDB 7.2.0 and later, the default value is 7500 milliseconds (7.5 seconds). Previously, this was 3000 milliseconds (3 seconds).

  • Arbitration

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.7enumerationDefaultDefault, Disabled, WaitExternal
    Restart Type: N

    The Arbitration parameter enables a choice of arbitration schemes, corresponding to one of 3 possible values for this parameter:

    • Default. This enables arbitration to proceed normally, as determined by the ArbitrationRank settings for the management and API nodes. This is the default value.

    • Disabled. Setting Arbitration = Disabled in the [ndbd default] section of the config.ini file to accomplishes the same task as setting ArbitrationRank to 0 on all management and API nodes. When Arbitration is set in this way, any ArbitrationRank settings are ignored.

    • WaitExternal. The Arbitration parameter also makes it possible to configure arbitration in such a way that the cluster waits until after the time determined by ArbitrationTimeout has passed for an external cluster manager application to perform arbitration instead of handling arbitration internally. This can be done by setting Arbitration = WaitExternal in the [ndbd default] section of the config.ini file. For best results with the WaitExternal setting, it is recommended that ArbitrationTimeout be 2 times as long as the interval required by the external cluster manager to perform arbitration.

    Important

    This parameter should be used only in the [ndbd default] section of the cluster configuration file. The behavior of the cluster is unspecified when Arbitration is set to different values for individual data nodes.

Buffering and logging. Several [ndbd] configuration parameters enable the advanced user to have more control over the resources used by node processes and to adjust various buffer sizes at need.

These buffers are used as front ends to the file system when writing log records to disk. If the node is running in diskless mode, these parameters can be set to their minimum values without penalty due to the fact that disk writes are "faked" by the NDB storage engine's file system abstraction layer.

  • UndoIndexBuffer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned2M1M - 4G
    Restart Type: N

    The UNDO index buffer, whose size is set by this parameter, is used during local checkpoints. The NDB storage engine uses a recovery scheme based on checkpoint consistency in conjunction with an operational REDO log. To produce a consistent checkpoint without blocking the entire system for writes, UNDO logging is done while performing the local checkpoint. UNDO logging is activated on a single table fragment at a time. This optimization is possible because tables are stored entirely in main memory.

    The UNDO index buffer is used for the updates on the primary key hash index. Inserts and deletes rearrange the hash index; the NDB storage engine writes UNDO log records that map all physical changes to an index page so that they can be undone at system restart. It also logs all active insert operations for each fragment at the start of a local checkpoint.

    Reads and updates set lock bits and update a header in the hash index entry. These changes are handled by the page-writing algorithm to ensure that these operations need no UNDO logging.

    This buffer is 2MB by default. The minimum value is 1MB, which is sufficient for most applications. For applications doing extremely large or numerous inserts and deletes together with large transactions and large primary keys, it may be necessary to increase the size of this buffer. If this buffer is too small, the NDB storage engine issues internal error code 677 (Index UNDO buffers overloaded).

    Important

    It is not safe to decrease the value of this parameter during a rolling restart.

  • UndoDataBuffer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned16M1M - 4G
    Restart Type: N

    This parameter sets the size of the UNDO data buffer, which performs a function similar to that of the UNDO index buffer, except the UNDO data buffer is used with regard to data memory rather than index memory. This buffer is used during the local checkpoint phase of a fragment for inserts, deletes, and updates.

    Because UNDO log entries tend to grow larger as more operations are logged, this buffer is also larger than its index memory counterpart, with a default value of 16MB.

    This amount of memory may be unnecessarily large for some applications. In such cases, it is possible to decrease this size to a minimum of 1MB.

    It is rarely necessary to increase the size of this buffer. If there is such a need, it is a good idea to check whether the disks can actually handle the load caused by database update activity. A lack of sufficient disk space cannot be overcome by increasing the size of this buffer.

    If this buffer is too small and gets congested, the NDB storage engine issues internal error code 891 (Data UNDO buffers overloaded).

    Important

    It is not safe to decrease the value of this parameter during a rolling restart.

  • RedoBuffer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes32M1M - 4G
    Restart Type: N

    All update activities also need to be logged. The REDO log makes it possible to replay these updates whenever the system is restarted. The NDB recovery algorithm uses a "fuzzy" checkpoint of the data together with the UNDO log, and then applies the REDO log to play back all changes up to the restoration point.

    RedoBuffer sets the size of the buffer in which the REDO log is written. The default value is 32MB; the minimum value is 1MB.

    If this buffer is too small, the NDB storage engine issues error code 1221 (REDO log buffers overloaded). For this reason, you should exercise care if you attempt to decrease the value of RedoBuffer as part of an online change in the cluster's configuration.

Controlling log messages. In managing the cluster, it is very important to be able to control the number of log messages sent for various event types to stdout. For each event category, there are 16 possible event levels (numbered 0 through 15). Setting event reporting for a given event category to level 15 means all event reports in that category are sent to stdout; setting it to 0 means that there will be no event reports made in that category.

By default, only the startup message is sent to stdout, with the remaining event reporting level defaults being set to 0. The reason for this is that these messages are also sent to the management server's cluster log.

An analogous set of levels can be set for the management client to determine which event levels to record in the cluster log.

  • LogLevelStartup

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer10 - 15
    Restart Type: N

    The reporting level for events generated during startup of the process.

    The default level is 1.

  • LogLevelShutdown

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for events generated as part of graceful shutdown of a node.

    The default level is 0.

  • LogLevelStatistic

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for statistical events such as number of primary key reads, number of updates, number of inserts, information relating to buffer usage, and so on.

    The default level is 0.

  • LogLevelCheckpoint

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0log level00 - 15
    Restart Type: N

    The reporting level for events generated by local and global checkpoints.

    The default level is 0.

  • LogLevelNodeRestart

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for events generated during node restart.

    The default level is 0.

  • LogLevelConnection

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for events generated by connections between cluster nodes.

    The default level is 0.

  • LogLevelError

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for events generated by errors and warnings by the cluster as a whole. These errors do not cause any node failure but are still considered worth reporting.

    The default level is 0.

  • LogLevelCongestion

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0levelr00 - 15
    Restart Type: N

    The reporting level for events generated by congestion. These errors do not cause node failure but are still considered worth reporting.

    The default level is 0.

  • LogLevelInfo

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0integer00 - 15
    Restart Type: N

    The reporting level for events generated for information about the general state of the cluster.

    The default level is 0.

  • MemReportFrequency

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned00 - 4G
    Restart Type: N

    This parameter controls how often data node memory usage reports are recorded in the cluster log; it is an integer value representing the number of seconds between reports.

    Each data node's data memory and index memory usage is logged as both a percentage and a number of 32 KB pages of the DataMemory and IndexMemory, respectively, set in the config.ini file. For example, if DataMemory is equal to 100 MB, and a given data node is using 50 MB for data memory storage, the corresponding line in the cluster log might look like this:

    2006-12-24 01:18:16 [MgmSrvr] INFO -- Node 2: Data usage is 50%(1280 32K pages of total 2560)

    MemReportFrequency is not a required parameter. If used, it can be set for all cluster data nodes in the [ndbd default] section of config.ini, and can also be set or overridden for individual data nodes in the corresponding [ndbd] sections of the configuration file. The minimum value-which is also the default value-is 0, in which case memory reports are logged only when memory usage reaches certain percentages (80%, 90%, and 100%), as mentioned in the discussion of statistics events in Section 17.5.6.2, "MySQL Cluster Log Events".

  • StartupStatusReportFrequency

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0seconds[none]...
    Restart Type: N

    When a data node is started with the --initial, it initializes the redo log file during Start Phase 4 (see Section 17.5.1, "Summary of MySQL Cluster Start Phases"). When very large values are set for NoOfFragmentLogFiles, FragmentLogFileSize, or both, this initialization can take a long time.You can force reports on the progress of this process to be logged periodically, by means of the StartupStatusReportFrequency configuration parameter. In this case, progress is reported in the cluster log, in terms of both the number of files and the amount of space that have been initialized, as shown here:

    2009-06-20 16:39:23 [MgmSrvr] INFO -- Node 1: Local redo log file initialization status:#Total files: 80, Completed: 60#Total MBytes: 20480, Completed: 155572009-06-20 16:39:23 [MgmSrvr] INFO -- Node 2: Local redo log file initialization status:#Total files: 80, Completed: 60#Total MBytes: 20480, Completed: 15570

    These reports are logged each StartupStatusReportFrequency seconds during Start Phase 4. If StartupStatusReportFrequency is 0 (the default), then reports are written to the cluster log only when at the beginning and at the completion of the redo log file initialization process.

Debugging Parameters. In MySQL Cluster NDB 7.2, it is possible to cause logging of traces for events generated by creating and dropping tables using DictTrace. This parameter is useful only in debugging NDB kernel code. DictTrace takes an integer value; currently, 0 (default - no logging) and 1 (logging enabled) are the only supported values.

Backup parameters. The [ndbd] parameters discussed in this section define memory buffers set aside for execution of online backups.

  • BackupDataBufferSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes16M0 - 4G
    Restart Type: N

    In creating a backup, there are two buffers used for sending data to the disk. The backup data buffer is used to fill in data recorded by scanning a node's tables. Once this buffer has been filled to the level specified as BackupWriteSize, the pages are sent to disk. While flushing data to disk, the backup process can continue filling this buffer until it runs out of space. When this happens, the backup process pauses the scan and waits until some disk writes have completed freed up memory so that scanning may continue.

    The default value for this parameter is 16MB.

  • BackupLogBufferSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes16M0 - 4G
    Restart Type: N

    The backup log buffer fulfills a role similar to that played by the backup data buffer, except that it is used for generating a log of all table writes made during execution of the backup. The same principles apply for writing these pages as with the backup data buffer, except that when there is no more space in the backup log buffer, the backup fails. For that reason, the size of the backup log buffer must be large enough to handle the load caused by write activities while the backup is being made. See Section 17.5.3.3, "Configuration for MySQL Cluster Backups".

    The default value for this parameter should be sufficient for most applications. In fact, it is more likely for a backup failure to be caused by insufficient disk write speed than it is for the backup log buffer to become full. If the disk subsystem is not configured for the write load caused by applications, the cluster is unlikely to be able to perform the desired operations.

    It is preferable to configure cluster nodes in such a manner that the processor becomes the bottleneck rather than the disks or the network connections.

    The default value for this parameter is 16MB.

  • BackupMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes32M0 - 4G
    Restart Type: N

    This parameter is simply the sum of BackupDataBufferSize and BackupLogBufferSize.

    The default value of this parameter in MySQL Cluster NDB 7.2 is 16MB + 16MB = 32MB.

    Important

    If BackupDataBufferSize and BackupLogBufferSize taken together exceed the default value for BackupMemory, then this parameter must be set explicitly in the config.ini file to their sum.

  • BackupReportFrequency

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.2.3seconds00 - 4G
    Restart Type: N

    This parameter controls how often backup status reports are issued in the management client during a backup, as well as how often such reports are written to the cluster log (provided cluster event logging is configured to permit it-see Logging and checkpointing). BackupReportFrequency represents the time in seconds between backup status reports.

    The default value is 0.

  • BackupWriteSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes256K2K - 4G
    Restart Type: N

    This parameter specifies the default size of messages written to disk by the backup log and backup data buffers.

    The default value for this parameter is 256KB.

  • BackupMaxWriteSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes1M2K - 4G
    NDB 7.2.1bytes1M2K - 4G
    Restart Type: N

    This parameter specifies the maximum size of messages written to disk by the backup log and backup data buffers.

    The default value for this parameter is 1MB.

Important

When specifying these parameters, the following relationships must hold true. Otherwise, the data node will be unable to start.

  • BackupDataBufferSize >= BackupWriteSize + 188KB

  • BackupLogBufferSize >= BackupWriteSize + 16KB

  • BackupMaxWriteSize >= BackupWriteSize

MySQL Cluster Realtime Performance Parameters

The [ndbd] parameters discussed in this section are used in scheduling and locking of threads to specific CPUs on multiprocessor data node hosts.

Note

To make use of these parameters, the data node process must be run as system root.

  • LockExecuteThreadToCPU

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.4CPU ID64K0 - 64K
    Restart Type: N

    When used with ndbd, this parameter (now a string) specifies the ID of the CPU assigned to handle the NDBCLUSTER execution thread. When used with ndbmtd, the value of this parameter is a comma-separated list of CPU IDs assigned to handle execution threads. Each CPU ID in the list should be an integer in the range 0 to 65535 (inclusive).

    The number of IDs specified should match the number of execution threads determined by MaxNoOfExecutionThreads. However, there is no guarantee that threads are assigned to CPUs in any given order when using this parameter; beginning with in MySQL Cluster NDB 7.2.5, you can obtain more finely-grained control of this type using ThreadConfig.

    LockExecuteThreadToCPU has no default value.

  • LockMaintThreadsToCPU

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0CPU ID[none]0 - 64K
    Restart Type: N

    This parameter specifies the ID of the CPU assigned to handle NDBCLUSTER maintenance threads.

    The value of this parameter is an integer in the range 0 to 65535 (inclusive). In MySQL Cluster NDB 7.2, there is no default value.

  • RealtimeScheduler

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.4booleanfalsetrue, false
    Restart Type: N

    Setting this parameter to 1 enables real-time scheduling of NDBCLUSTER threads.

    The default is 0 (scheduling disabled).

  • SchedulerExecutionTimer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.4�sec500 - 11000
    Restart Type: N

    This parameter specifies the time in microseconds for threads to be executed in the scheduler before being sent. Setting it to 0 minimizes the response time; to achieve higher throughput, you can increase the value at the expense of longer response times.

    The default is 50 µsec, which our testing shows to increase throughput slightly in high-load cases without materially delaying requests.

  • SchedulerSpinTimer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.4�sec00 - 500
    Restart Type: N

    This parameter specifies the time in microseconds for threads to be executed in the scheduler before sleeping.

    The default value is 0.

  • BuildIndexThreads

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.11numeric00 - 128
    Restart Type: S

    This parameter determines the number of threads to create when rebuilding indexes during a system or node start. It is supported only when there is more than one fragment for the table per data node (for example, when the MAX_ROWS option has been used with CREATE TABLE).

    Setting this parameter to 0 (which is also the default value) disables multi-threaded building of ordered indexes. The maximum allowed value is 128.

    This parameter is supported when using ndbd or ndbmtd.

    You can enable multi-threaded builds during data node initial restarts by setting the TwoPassInitialNodeRestartCopy data node configuration parameter to TRUE.

  • TwoPassInitialNodeRestartCopy

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.11booleanfalsetrue, false
    Restart Type: N

    Multi-threaded building of ordered indexes can be enabled for initial restarts of data nodes by setting this configuration parameter to TRUE, which enables two-pass copying of data during initial node restarts.

    You must also set BuildIndexThreads to a nonzero value.

  • Numa

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.9booleanfalse...
    Restart Type: N

    NDB is extremely sensitive to Non-Uniform Memory Access settings and multi-CPU systems due to timeouts that it can cause. Due to this fact, and because most MySQL Cluster users do not employ numactl, support for NUMA is ignored by default by ndbd when running on a Linux system. If your Linux system provides NUMA support and you wish for data node memory to be subject to NUMA control, you can set this parameter equal to 0.

    The Numa configuration parameter is supported only on Linux systems where libnuma.so is installed.

Multi-Threading Configuration Parameters (ndbmtd). ndbmtd runs by default as a single-threaded process and must be configured to use multiple threads, using either of two methods, both of which require setting configuration parameters in the config.ini file. The first method is simply to set an appropriate value for the MaxNoOfExecutionThreads configuration parameter. In MySQL Cluster NDB 7.2.3 and later, a second method is also supported, whereby it is possible to set up more complex rules for ndbmtd multi-threading using ThreadConfig. The next few paragraphs provide information about these parameters and their use with multi-threaded data nodes.

  • MaxNoOfExecutionThreads

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4integer22 - 8
    NDB 7.2.5integer22 - 36
    Restart Type: N

    Starting with MySQL Cluster NDB 7.2.5, this parameter directly controls the number of execution threads used by ndbmtd, up to a maximum of 36. Although this parameter is set in [ndbd] or [ndbd default] sections of the config.ini file, it is exclusive to ndbmtd and does not apply to ndbd.

    Setting MaxNoOfExecutionThreads sets the number of threads by type as determined in the following table:

    MaxNoOfExecutionThreads ValueLQH ThreadsTC ThreadsSend ThreadsReceive Threads
    0 .. 31101
    4 .. 62101
    7 .. 84101
    94201
    104211
    114311
    124312
    134322
    144422
    154522
    168312
    178412
    188422
    198522
    208523
    218533
    228633
    238733
    2412523
    2512623
    2612633
    2712733
    2812734
    2912834
    3012844
    3112944
    3216833
    3316834
    3416844
    3516944
    36161044

    There is always one SUMA (replication) thread. There was no separate send thread in MySQL Cluster NDB 7.2.4 and earlier, as well as no means of changing the number of TC threads.

    The thread types are described later in this section (see ThreadConfig).

    Setting this parameter outside the permitted range of values causes the management server to abort on startup with the error Error line number: Illegal value value for parameter MaxNoOfExecutionThreads.

    For MaxNoOfExecutionThreads, a value of 0 or 1 is rounded up internally by NDB to 2, so that 2 is considered this parameter's default and minimum value.

    MaxNoOfExecutionThreads is generally intended to be set equal to the number of CPU threads available, and to allocate a number of threads of each type suitable to typical workloads. It does not assign particular threads to specified CPUs. For cases where it is desirable to vary from the settings provided, or to bind threads to CPUs, you should use ThreadConfig instead, which allows you to allocate each thread directly to a desired type, CPU, or both.

    In MySQL Cluster NDB 7.2.5 and later, the multi-threaded data node process always spawns at least 5 threads, listed here:

    • 1 local query handler (LQH) thread

    • 1 transaction coordinator (TC) thread

    • 1 send thread

      (It is possible to keep any separate send threads from being employed, as explained elsewhere in this section.)

    • 1 receive thread

    • 1 subscription manager (SUMA or replication) thread

    In MySQL Cluster NDB 7.2.4 and earlier, there were only 4 thread types, with LDM threads being responsible for their own sends. In addition, it was not possible to cause ndbmtd to use more than 1 TC thread.

  • NoOfFragmentLogParts

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.5numeric44, 8, 12, 16
    Restart Type: IN

    Set the number of log file groups for redo logs belonging to this ndbmtd. The value must be an even multiple of 4 between 4 and 16, inclusive.

  • ThreadConfig

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.17string''...
    NDB 7.2.3string''...
    Restart Type: N

    This parameter is used with ndbmtd to assign threads of different types to different CPUs. Its value is a string whose format has the following syntax:

    ThreadConfig := entry[,entry[,...]]entry := type={param[,param[,...]]}type := ldm | main | recv | send | rep | ioparam := count=number | cpubind=cpu_list

    The curly braces ({...}) surrounding the list of parameters is required, even if there is only one parameter in the list.

    A param (parameter) specifies the number of threads of the given type (count), the CPUs to which the threads of the given type are to be bound (cpubind), or both.

    The type attribute represents an NDB thread type. The thread types supported in MySQL Cluster NDB 7.2 and the range of permitted count values for each are provided in the following list:

    • ldm: Local query handler (DBLQH kernel block) that handles data. The more LDM threads that are used, the more highly partitioned the data becomes. Each LDM thread maintains its own sets of data and index partitions, as well as its own redo log. In MySQL Cluster NDB 7.2, the maximum is 16 such threads (in MySQL Cluster NDB 7.1, the maximum was 4).

      Range: 1 - 16.

    • tc: Transaction coordinator thread (DBTC kernel block) containing the state of an ongoing transaction. In MySQL Cluster NDB 7.2.5 and later, the number of TC threads is configurable, with a total of 16 possible.

      Optimally, every new transaction can be assigned to a new TC thread. In most cases 1 TC thread per 2 LDM threads is sufficient to guarantee that this can happen. In cases where the number of writes is relatively small when compared to the number of reads, it is possible that only 1 TC thread per 4 LQH threads is required to maintain transaction states. Conversely, in applications that perform a great many updates, it may be necessary for the ratio of TC threads to LDM threads to approach 1 (for example, 3 TC threads to 4 LDM threads).

      Range: 1 - 16 (always 1 prior to MySQL Cluster 7.2.5).

    • main: Data dictionary and transaction coordinator (DBDIH and DBTC kernel blocks), providing schema management. This is always handled by a single dedicated thread.

      Range: 1 only.

    • recv: Receive thread (CMVMI kernel block). Each receive thread handles one or more sockets for communicating with other nodes in a MySQL Cluster, with one socket per node. Previously, this was limited to a single thread, but MySQL Cluster 7.2 implements multiple receive threads (up to 8).

      Range: 1 - 8.

    • send: Send thread (CMVMI kernel block). Added in MySQL Cluster NDB 7.2.5. To increase throughput, it is possible in MySQL Cluster NDB 7.2.5 and later to perform sends from one or more separate, dedicated threads (maximum 8).

      Previously, all threads handled their own sending directly; this can still be made to happen by setting the number of send threads to 0 (this also happens when MaxNoOfExecutionThreads is set equal to 9). While doing so can have an adeverse impact on throughput, it can also in some cases provide decreased latency.

      Range: 0 - 8.

    • rep: Replication thread (SUMA kernel block). Asynchronous replication operations are always handled by a single.dedicated thread.

      Range: 1 only.

    • io: File system and other miscellaneous operations. These are not demanding tasks, and are always handled as a group by a single, dedicated I/O thread.

      Range: 1 only.

Simple examples:

# Example 1.ThreadConfig=ldm={count=2,cpubind=1,2},main={cpubind=12},rep={cpubind=11}# Example 2.Threadconfig=main={cpubind=0},ldm={count=4,cpubind=1,2,5,6},io={count=2,cpubind=3,4}

It is usually desirable when configuring thread usage for a data node host to reserve one or more number of CPUs for operating system and other tasks. Thus, for a host machine with 24 CPUs, you might want to use 20 CPU threads (leaving 4 for other uses), with 8 LDM threads, 4 TC threads (half the number of LDM threads), 3 send threads, 3 receive threads, and 1 thread each for schema management, asynchronous replication, and I/O operations. (This is almost the same distribution of threads used when MaxNoOfExecutionThreads is set equal to 20.) The following ThreadConfig setting performs these assignments, additionally binding all of these threads to specific CPUs:

ThreadConfig=ldm{count=8,cpubind=1,2,3,4,5,6,7,8},main={cpubind=9},io={cpubind=9}, \rep={cpubind=10},tc{count=4,cpubind=11,12,13,14},recv={count=3,cpubind=15,16,17}, \send{count=3,cpubind=18,19,20}

It should be possible in most cases to bind the main (schema management) thread and the I/O thread to the same CPU, as we have done in the example just shown.

In order to take advantage of the enhaced stability that the use of ThreadConfig offers, it is necessary to insure that CPUs are isolated, and that they not subject to interrupts, or to being scheduled for other tasks by the operating system. On many Linux systems, you can do this by setting IRQBALANCE_BANNED_CPUS in /etc/sysconfig/irqbalance to 0xFFFFF0, and by using the isolcpus boot option in grub.conf. For specific information, see your operating system or platform documentation.

Disk Data Configuration Parameters. Configuration parameters affecting Disk Data behavior include the following:

  • DiskPageBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes64M4M - 1T
    Restart Type: N

    This determines the amount of space used for caching pages on disk, and is set in the [ndbd] or [ndbd default] section of the config.ini file. It is measured in bytes. Each page takes up 32 KB. This means that Cluster Disk Data storage always uses N * 32 KB memory where N is some nonnegative integer.

    The default value for this parameter is 64M (2000 pages of 32 KB each).

    You can query the ndbinfo.diskpagebuffer table to help determine whether the value for this parameter should be increased to minimize unnecessary disk seeks. See Section 17.5.10.8, "The ndbinfo diskpagebuffer Table", for more information.

  • SharedGlobalMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes20M0 - 64T
    Restart Type: N

    This parameter determines the amount of memory that is used for log buffers, disk operations (such as page requests and wait queues), and metadata for tablespaces, log file groups, UNDO files, and data files. The shared global memory pool also provides memory used for satisfying the memory requirements of the INITIAL_SIZE and UNDO_BUFFER_SIZE options used with CREATE LOGFILE GROUP and ALTER LOGFILE GROUP statements, including any default value implied for these options by the setting of the InitialLogFileGroup data node configuration parameter. SharedGlobalMemory can be set in the [ndbd] or [ndbd default] section of the config.ini configuration file, and is measured in bytes.

    As of MySQL Cluster NDB 7.2.0, the default value is 128M. (Previously, this was 20M.)

  • DiskIOThreadPool

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.0threads20 - 4G
    Restart Type: N

    This parameter determines the number of unbound threads used for Disk Data file access. Before DiskIOThreadPool was introduced, exactly one thread was spawned for each Disk Data file, which could lead to performance issues, particularly when using very large data files. With DiskIOThreadPool, you can-for example-access a single large data file using several threads working in parallel.

    Currently, this parameter applies to Disk Data I/O threads only, but we plan in the future to make the number of such threads configurable for in-memory data as well.

    The optimum value for this parameter depends on your hardware and configuration, and includes these factors:

    • Physical distribution of Disk Data files. You can obtain better performance by placing data files, undo log files, and the data node file system on separate physical disks. If you do this with some or all of these sets of files, then you can set DiskIOThreadPool higher to enable separate threads to handle the files on each disk.

    • Disk performance and types. The number of threads that can be accommodated for Disk Data file handling is also dependent on the speed and throughput of the disks. Faster disks and higher throughput allow for more disk I/O threads. Our test results indicate that solid-state disk drives can handle many more disk I/O threads than conventional disks, and thus higher values for DiskIOThreadPool.

    In MySQL Cluster NDB 7.2, the default value for this parameter is 2.

  • Disk Data file system parameters. The parameters in the following list make it possible to place MySQL Cluster Disk Data files in specific directories without the need for using symbolic links.

    • FileSystemPathDD

      Effective VersionType/UnitsDefaultRange or Permitted Values
      NDB 6.4.3filename[see text]...
      Restart Type: IN

      If this parameter is specified, then MySQL Cluster Disk Data data files and undo log files are placed in the indicated directory. This can be overridden for data files, undo log files, or both, by specifying values for FileSystemPathDataFiles, FileSystemPathUndoFiles, or both, as explained for these parameters. It can also be overridden for data files by specifying a path in the ADD DATAFILE clause of a CREATE TABLESPACE or ALTER TABLESPACE statement, and for undo log files by specifying a path in the ADD UNDOFILE clause of a CREATE LOGFILE GROUP or ALTER LOGFILE GROUP statement. If FileSystemPathDD is not specified, then FileSystemPath is used.

      If a FileSystemPathDD directory is specified for a given data node (including the case where the parameter is specified in the [ndbd default] section of the config.ini file), then starting that data node with --initial causes all files in the directory to be deleted.

    • FileSystemPathDataFiles

      Effective VersionType/UnitsDefaultRange or Permitted Values
      NDB 6.4.3filename[see text]...
      Restart Type: IN

      If this parameter is specified, then MySQL Cluster Disk Data data files are placed in the indicated directory. This overrides any value set for FileSystemPathDD. This parameter can be overridden for a given data file by specifying a path in the ADD DATAFILE clause of a CREATE TABLESPACE or ALTER TABLESPACE statement used to create that data file. If FileSystemPathDataFiles is not specified, then FileSystemPathDD is used (or FileSystemPath, if FileSystemPathDD has also not been set).

      If a FileSystemPathDataFiles directory is specified for a given data node (including the case where the parameter is specified in the [ndbd default] section of the config.ini file), then starting that data node with --initial causes all files in the directory to be deleted.

    • FileSystemPathUndoFiles

      Effective VersionType/UnitsDefaultRange or Permitted Values
      NDB 6.4.3filename[see text]...
      Restart Type: IN

      If this parameter is specified, then MySQL Cluster Disk Data undo log files are placed in the indicated directory. This overrides any value set for FileSystemPathDD. This parameter can be overridden for a given data file by specifying a path in the ADD UNDO clause of a CREATE LOGFILE GROUP or CREATE LOGFILE GROUP statement used to create that data file. If FileSystemPathUndoFiles is not specified, then FileSystemPathDD is used (or FileSystemPath, if FileSystemPathDD has also not been set).

      If a FileSystemPathUndoFiles directory is specified for a given data node (including the case where the parameter is specified in the [ndbd default] section of the config.ini file), then starting that data node with --initial causes all files in the directory to be deleted.

    For more information, see Section 17.5.12.1, "MySQL Cluster Disk Data Objects".

  • Disk Data object creation parameters. The next two parameters enable you-when starting the cluster for the first time-to cause a Disk Data log file group, tablespace, or both, to be created without the use of SQL statements.

    • InitialLogFileGroup

      Effective VersionType/UnitsDefaultRange or Permitted Values
      NDB 6.4.3string[see text]...
      Restart Type: S

      This parameter can be used to specify a log file group that is created when performing an initial start of the cluster. InitialLogFileGroup is specified as shown here:

      InitialLogFileGroup = [name=name;] [undo_buffer_size=size;] file-specification-listfile-specification-list: file-specification[; file-specification[; ...]]file-specification: filename:size

      The name of the log file group is optional and defaults to DEFAULT-LG. The undo_buffer_size is also optional; if omitted, it defaults to 64M. Each file-specification corresponds to an undo log file, and at least one must be specified in the file-specification-list. Undo log files are placed according to any values that have been set for FileSystemPath, FileSystemPathDD, and FileSystemPathUndoFiles, just as if they had been created as the result of a CREATE LOGFILE GROUP or ALTER LOGFILE GROUP statement.

      Consider the following:

      InitialLogFileGroup = name=LG1; undo_buffer_size=128M; undo1.log:250M; undo2.log:150M

      This is equivalent to the following SQL statements:

      CREATE LOGFILE GROUP LG1 ADD UNDOFILE 'undo1.log' INITIAL_SIZE 250M UNDO_BUFFER_SIZE 128M ENGINE NDBCLUSTER;ALTER LOGFILE GROUP LG1 ADD UNDOFILE 'undo2.log' INITIAL_SIZE 150M ENGINE NDBCLUSTER;

      This logfile group is created when the data nodes are started with --initial.

      Resources for the initial log file group are taken from the global memory pool whose size is determined by the value of the SharedGlobalMemory data node configuration parameter; if this parameter is set too low and the values set in InitialLogFileGroup for the logfile group's initial size or undo buffer size are too high, the cluster may fail to create the default log file group when starting, or fail to start altogether.

      This parameter, if used, should always be set in the [ndbd default] section of the config.ini file. The behavior of a MySQL Cluster when different values are set on different data nodes is not defined.

    • InitialTablespace

      Effective VersionType/UnitsDefaultRange or Permitted Values
      NDB 6.4.3string[see text]...
      Restart Type: S

      This parameter can be used to specify a MySQL Cluster Disk Data tablespace that is created when performing an initial start of the cluster. InitialTablespace is specified as shown here:

      InitialTablespace = [name=name;] [extent_size=size;] file-specification-list

      The name of the tablespace is optional and defaults to DEFAULT-TS. The extent_size is also optional; it defaults to 1M. The file-specification-list uses the same syntax as shown with the InitialLogfileGroup parameter, the only difference being that each file-specification used with InitialTablespace corresponds to a data file. At least one must be specified in the file-specification-list. Data files are placed according to any values that have been set for FileSystemPath, FileSystemPathDD, and FileSystemPathDataFiles, just as if they had been created as the result of a CREATE TABLESPACE or ALTER TABLESPACE statement.

      For example, consider the following line specifying InitialTablespace in the [ndbd default] section of the config.ini file (as with InitialLogfileGroup, this parameter should always be set in the [ndbd default] section, as the behavior of a MySQL Cluster when different values are set on different data nodes is not defined):

      InitialTablespace = name=TS1; extent_size=8M; data1.dat:2G; data2.dat:4G

      This is equivalent to the following SQL statements:

      CREATE TABLESPACE TS1 ADD DATAFILE 'data1.dat' EXTENT_SIZE 8M INITIAL_SIZE 2G ENGINE NDBCLUSTER;ALTER TABLESPACE TS1 ADD UNDOFILE 'data2.dat' INITIAL_SIZE 4G ENGINE NDBCLUSTER;

      This tablespace is created when the data nodes are started with --initial, and can be used whenever creating MySQL Cluster Disk Data tables thereafter.

Disk Data and GCP Stop errors. Errors encountered when using Disk Data tables such as Node nodeid killed this node because GCP stop was detected (error 2303) are often referred to as "GCP stop errors". Such errors occur when the redo log is not flushed to disk quickly enough; this is usually due to slow disks and insufficient disk throughput.

You can help prevent these errors from occurring by using faster disks, and by placing Disk Data files on a separate disk from the data node file system. Reducing the value of TimeBetweenGlobalCheckpoints tends to decrease the amount of data to be written for each global checkpoint, and so may provide some protection against redo log buffer overflows when trying to write a global checkpoint; however, reducing this value also permits less time in which to write the GCP, so this must be done with caution.

In addition to the considerations given for DiskPageBufferMemory as explained previously, it is also very important that the DiskIOThreadPool configuration parameter be set correctly; having DiskIOThreadPool set too high is very likely to cause GCP stop errors (Bug #37227).

GCP stops can be caused by save or commit timeouts; the TimeBetweenEpochsTimeout data node configuration parameter determines the timeout for commits. However, it is possible to disable both types of timeouts by setting this parameter to 0.

Parameters for configuring send buffer memory allocation. Send buffer memory is allocated dynamically from a memory pool shared between all transporters, which means that the size of the send buffer can be adjusted as necessary. (Previously, the NDB kernel used a fixed-size send buffer for every node in the cluster, which was allocated when the node started and could not be changed while the node was running.) The TotalSendBufferMemory and OverLoadLimit data node configuration parameters permit the setting of limits on this memory allocation. For more information about the use of these parameters (as well as SendBufferMemory), see Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters".

  • ExtraSendBufferMemory

    This parameter specifies the amount of transporter send buffer memory to allocate in addition to any set using TotalSendBufferMemory, SendBufferMemory, or both.

    This parameter was added in MySQL Cluster NDB 7.2.5. (Bug #11760629, Bug #53053)

  • TotalSendBufferMemory

    This parameter is available beginning with MySQL Cluster NDB 6.4.0. It is used to determine the total amount of memory to allocate on this node for shared send buffer memory among all configured transporters.

    Prior to MySQL Cluster NDB 7.2.5, this parameter did not work correctly with ndbmtd. (Bug #13633845)

    If this parameter is set, its minimum permitted value is 256KB; the maxmimum is 4294967039.

  • ReservedSendBufferMemory

    This parameter is present in NDBCLUSTER source code beginning with MySQL Cluster NDB 6.4.0. However, it is not currently enabled.

    As of MySQL Cluster NDB 7.2.5, this parameter is deprecated, and is subject to removal in a future release of MySQL Cluster (Bug #11760629, Bug #53053).

For more detailed information about the behavior and use of TotalSendBufferMemory and about configuring send buffer memory parameters in MySQL Cluster, see Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters".

See also Section 17.5.13, "Adding MySQL Cluster Data Nodes Online".

Redo log over-commit handling. It is possible to control a data node's handling of operations when too much time is taken flushing redo logs to disk. This occurs when a given redo log flush takes longer than RedoOverCommitLimit seconds, more than RedoOverCommitCounter times, causing any pending transactions to be aborted. When this happens, the API node that sent the transaction can handle the operations that should have been committed either by queuing the operations and re-trying them, or by aborting them, as determined by DefaultOperationRedoProblemAction. The data node configuration parameters for setting the timeout and number of times it may be exceeded before the API node takes this action are described in the following list:

  • RedoOverCommitCounter

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.10numeric30 - 4G
    Restart Type: N

    When RedoOverCommitLimit is exceeded when trying to write a given redo log to disk this many times or more, any transactions that were not committed as a result are aborted, and an API node where any of these transactions originated handles the operations making up those transactions according to its value for DefaultOperationRedoProblemAction (by either queuing the operations to be re-tried, or aborting them).

    RedoOverCommitCounter defaults to 3. Set it to 0 to disable the limit.

  • RedoOverCommitLimit

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.10seconds200 - 4G
    Restart Type: N

    This parameter sets an upper limit in seconds for trying to write a given redo log to disk before timing out. The number of times the data node tries to flush this redo log, but takes longer than RedoOverCommitLimit, is kept and compared with RedoOverCommitCounter, and when flushing takes too long more times than the value of that parameter, any transactions that were not committed as a result of the flush timeout are aborted. When this occurs, the API node where any of these transactions originated handles the operations making up those transactions according to its DefaultOperationRedoProblemAction setting (it either queues the operations to be re-tried, or aborts them).

    By default, RedoOverCommitLimit is 20 seconds. Set to 0 to disable checking for redo log flush timeouts. This parameter was added in MySQL Cluster NDB 7.1.10.

Controlling restart attempts. It is possible to exercise finely-grained control over restart attempts by data nodes when they fail to start using the MaxStartFailRetries and StartFailRetryDelay data node configuration parameters.

MaxStartFailRetries limits the total number of retries made before giving up on starting the data node, StartFailRetryDelay sets the number of seconds between retry attempts. These parameters are described in more detail in the next few paragraphs.

StartFailRetryDelay

Effective VersionType/UnitsDefaultRange or Permitted Values
NDB 6.2.19unsigned00 - 4G
Restart Type: N

Use this parameter to set the number of seconds between restart attempts by the data node in the event on failure on startup. The default is 0 (no delay).

Note

This parameter is ignored unless StopOnError is equal to 0.

MaxStartFailRetries

Effective VersionType/UnitsDefaultRange or Permitted Values
NDB 6.2.19unsigned30 - 4G
Restart Type: N

Use this parameter to limit the number restart attempts made by the data node in the event that it fails on startup. The default is 3 attempts.

Note

This parameter is ignored unless StopOnError is equal to 0.

17.3.2.7. Defining SQL and Other API Nodes in a MySQL Cluster

The [mysqld] and [api] sections in the config.ini file define the behavior of the MySQL servers (SQL nodes) and other applications (API nodes) used to access cluster data. None of the parameters shown is required. If no computer or host name is provided, any host can use this SQL or API node.

Generally speaking, a [mysqld] section is used to indicate a MySQL server providing an SQL interface to the cluster, and an [api] section is used for applications other than mysqld processes accessing cluster data, but the two designations are actually synonymous; you can, for instance, list parameters for a MySQL server acting as an SQL node in an [api] section.

Note

For a discussion of MySQL server options for MySQL Cluster, see Section 17.3.4.2, "MySQL Server Options for MySQL Cluster"; for information about MySQL server system variables relating to MySQL Cluster, see Section 17.3.4.3, "MySQL Cluster System Variables".

  • Id

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.1.1unsigned[none]1 - 255
    Restart Type: N

    The Id is an integer value used to identify the node in all cluster internal messages. The permitted range of values is 1 to 255 inclusive. This value must be unique for each node in the cluster, regardless of the type of node.

    Note

    Data node IDs must be less than 49, regardless of the MySQL Cluster version used. If you plan to deploy a large number of data nodes, it is a good idea to limit the node IDs for API nodes (and management nodes) to values greater than 48.

    NodeId is the preferred parameter name to use when identifying API nodes. (Id continues to be supported for backward compatibility, but is now deprecated and generates a warning when used. It is also subject to future removal.)

  • NodeId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.1.1unsigned[none]1 - 255
    Restart Type: N

    The NodeId is an integer value used to identify the node in all cluster internal messages. The permitted range of values is 1 to 255 inclusive. This value must be unique for each node in the cluster, regardless of the type of node.

    Note

    Data node IDs must be less than 49, regardless of the MySQL Cluster version used. If you plan to deploy a large number of data nodes, it is a good idea to limit the node IDs for API nodes (and management nodes) to values greater than 48.

    NodeId is the preferred parameter name to use when identifying management nodes in MySQL Cluster NDB 7.2 and later. Previously, Id was used for this purpose and this continues to be supported for backward compatibility. Id is now deprecated and generates a warning when used; it is subject to removal in a future release of MySQL Cluster.

  • ExecuteOnComputer

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name[none]...
    Restart Type: S

    This refers to the Id set for one of the computers (hosts) defined in a [computer] section of the configuration file.

  • HostName

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: S

    Specifying this parameter defines the hostname of the computer on which the SQL node (API node) is to reside. To specify a hostname, either this parameter or ExecuteOnComputer is required.

    If no HostName or ExecuteOnComputer is specified in a given [mysql] or [api] section of the config.ini file, then an SQL or API node may connect using the corresponding "slot" from any host which can establish a network connection to the management server host machine. This differs from the default behavior for data nodes, where localhost is assumed for HostName unless otherwise specified.

  • ArbitrationRank

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.00-200 - 2
    Restart Type: N

    This parameter defines which nodes can act as arbitrators. Both MGM nodes and SQL nodes can be arbitrators. A value of 0 means that the given node is never used as an arbitrator, a value of 1 gives the node high priority as an arbitrator, and a value of 2 gives it low priority. A normal configuration uses the management server as arbitrator, setting its ArbitrationRank to 1 (the default for management nodes) and those for all SQL nodes to 0 (the default for SQL nodes).

    By setting ArbitrationRank to 0 on all management and SQL nodes, you can disable arbitration completely. You can also control arbitration by overriding this parameter; to do so, set the Arbitration parameter in the [ndbd default] section of the config.ini global configuration file.

  • ArbitrationDelay

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0milliseconds00 - 4G
    Restart Type: N

    Setting this parameter to any other value than 0 (the default) means that responses by the arbitrator to arbitration requests will be delayed by the stated number of milliseconds. It is usually not necessary to change this value.

  • BatchByteSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes32K1024 - 1M
    NDB 7.2.1bytes16K1024 - 1M
    Restart Type: N

    For queries that are translated into full table scans or range scans on indexes, it is important for best performance to fetch records in properly sized batches. It is possible to set the proper size both in terms of number of records (BatchSize) and in terms of bytes (BatchByteSize). The actual batch size is limited by both parameters.

    The speed at which queries are performed can vary by more than 40% depending upon how this parameter is set. In future releases, MySQL Server will make educated guesses on how to set parameters relating to batch size, based on the query type.

    This parameter is measured in bytes and by default is equal to 16KB in MySQL Cluster NDB 7.2.1 and later. (Previously, the default was 32K.)

  • BatchSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0records641 - 992
    NDB 7.2.1records2561 - 992
    Restart Type: N

    This parameter is measured in number of records and is by default set to 256 (MySQL Cluster NDB 7.2.1 and later; previously, the default was 64). The maximum size is 992.

  • HeartbeatThreadPriority

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.2string[none]...
    Restart Type: S

    Use this parameter to set the scheduling policy and priority of heartbeat threads for management and API nodes. The syntax for setting this parameter is shown here:

    HeartbeatThreadPriority = policy[, priority]policy:  {FIFO | RR}

    When setting this parameter, you must specify a policy. This is one of FIFO (first in, first in) or RR (round robin). This followed optionally by the priority (an integer).

  • MaxScanBatchSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes256K32K - 16M
    Restart Type: N

    The batch size is the size of each batch sent from each data node. Most scans are performed in parallel to protect the MySQL Server from receiving too much data from many nodes in parallel; this parameter sets a limit to the total batch size over all nodes.

    The default value of this parameter is set to 256KB. Its maximum size is 16MB.

  • TotalSendBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0bytes256K0 - 4G
    Restart Type: N

    This parameter is available beginning with MySQL Cluster NDB 6.4.0. It is used to determine the total amount of memory to allocate on this node for shared send buffer memory among all configured transporters.

    If this parameter is set, its minimum permitted value is 256KB; the maxmimum is 4294967039. For more detailed information about the behavior and use of TotalSendBufferMemory and configuring send buffer memory parameters in MySQL Cluster, see Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters".

  • AutoReconnect

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.7booleanfalsetrue, false
    Restart Type: N

    This parameter is false by default. This forces disconnected API nodes (including MySQL Servers acting as SQL nodes) to use a new connection to the cluster rather than attempting to re-use an existing one, as re-use of connections can cause problems when using dynamically-allocated node IDs. (Bug #45921)

    Note

    This parameter can be overridden using the NDB API. For more information, see Ndb_cluster_connection::set_auto_reconnect(), and Ndb_cluster_connection::get_auto_reconnect().

  • DefaultOperationRedoProblemAction

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.1.10enumerationABORTABORT, QUEUE
    NDB 7.2.1enumerationABORTABORT, QUEUE
    NDB 7.2.10enumerationQUEUEABORT, QUEUE
    Restart Type: S

    This parameter (along with RedoOverCommitLimit and RedoOverCommitCounter) controls the data node's handling of operations when too much time is taken flushing redo logs to disk. This occurs when a given redo log flush takes longer than RedoOverCommitLimit seconds, more than RedoOverCommitCounter times, causing any pending transactions to be aborted.

    When this happens, the node can respond in either of two ways, according to the value of DefaultOperationRedoProblemAction, listed here:

    • ABORT: Any pending operations from aborted transactions are also aborted.

    • QUEUE: Pending operations from transactions that were aborted are queued up to be re-tried.

    Prior to MySQL Cluster NDB 7.2.10, setting this parameter did not have any effect. (Bug #15855588)

You can obtain some information from a MySQL server running as a Cluster SQL node using SHOW STATUS in the mysql client, as shown here:

mysql> SHOW STATUS LIKE 'ndb%';+-----------------------------+---------------+| Variable_name   | Value |+-----------------------------+---------------+| Ndb_cluster_node_id | 5 || Ndb_config_from_host | 192.168.0.112 || Ndb_config_from_port | 1186  || Ndb_number_of_storage_nodes | 4 |+-----------------------------+---------------+4 rows in set (0.02 sec)

For information about these Cluster system status variables, see Section 5.1.6, "Server Status Variables".

Note

To add new SQL or API nodes to the configuration of a running MySQL Cluster, it is necessary to perform a rolling restart of all cluster nodes after adding new [mysqld] or [api] sections to the config.ini file (or files, if you are using more than one management server). This must be done before the new SQL or API nodes can connect to the cluster.

It is not necessary to perform any restart of the cluster if new SQL or API nodes can employ previously unused API slots in the cluster configuration to connect to the cluster.

17.3.2.8. MySQL Cluster TCP/IP Connections

TCP/IP is the default transport mechanism for all connections between nodes in a MySQL Cluster. Normally it is not necessary to define TCP/IP connections; MySQL Cluster automatically sets up such connections for all data nodes, management nodes, and SQL or API nodes.

To override the default connection parameters, it is necessary to define a connection using one or more [tcp] sections in the config.ini file. Each [tcp] section explicitly defines a TCP/IP connection between two MySQL Cluster nodes, and must contain at a minimum the parameters NodeId1 and NodeId2, as well as any connection parameters to override.

It is also possible to change the default values for these parameters by setting them in the [tcp default] section.

Important

Any [tcp] sections in the config.ini file should be listed last, following all other sections in the file. However, this is not required for a [tcp default] section. This requirement is a known issue with the way in which the config.ini file is read by the MySQL Cluster management server.

Connection parameters which can be set in [tcp] and [tcp default] sections of the config.ini file are listed here:

  • NodeId1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    NodeId2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    To identify a connection between two nodes it is necessary to provide their node IDs in the [tcp] section of the configuration file. These are the same unique NodeId (or Id) values for each of these nodes as described in Section 17.3.2.7, "Defining SQL and Other API Nodes in a MySQL Cluster".

  • HostName1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    HostName2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    The HostName1 and HostName2 parameters can be used to specify specific network interfaces to be used for a given TCP connection between two nodes. The values used for these parameters can be hostnames or IP addresses.

  • OverloadLimit

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0bytes00 - 4G
    Restart Type: N

    When more than this many unsent bytes are in the send buffer, the connection is considered overloaded.

    This parameter can be used to determine the amount of unsent data that must be present in the send buffer before the connection is considered overloaded. See Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters", for more information.

    In some older releases, the effective value of this parameter was limited by the size of SendBufferMemory; in MySQL Cluster NDB 7.2, the actual value for OverloadLimit (up to the stated maximum of 4G) is used instead.

  • SendBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4unsigned2M256K - 4G
    Restart Type: N

    TCP transporters use a buffer to store all messages before performing the send call to the operating system. When this buffer reaches 64KB its contents are sent; these are also sent when a round of messages have been executed. To handle temporary overload situations it is also possible to define a bigger send buffer.

    If this parameter is set explicitly, then the memory is not dedicated to each transporter; instead, the value used denotes the hard limit for how much memory (out of the total available memory-that is, TotalSendBufferMemory) that may be used by a single transporter. For more information about configuring dynamic transporter send buffer memory allocation in MySQL Cluster, see Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters".

    The default size of the send buffer in MySQL Cluster NDB 7.2 is 2MB, which is the size recommended in most situations. The minimum size is 64 KB; the theoretical maximum is 4 GB.

  • SendSignalId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0boolean[see text]true, false
    Restart Type: N

    To be able to retrace a distributed message datagram, it is necessary to identify each message. When this parameter is set to Y, message IDs are transported over the network. This feature is disabled by default in production builds, and enabled in -debug builds.

  • Checksum

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0booleanfalsetrue, false
    Restart Type: N

    This parameter is a boolean parameter (enabled by setting it to Y or 1, disabled by setting it to N or 0). It is disabled by default. When it is enabled, checksums for all messages are calculated before they placed in the send buffer. This feature ensures that messages are not corrupted while waiting in the send buffer, or by the transport mechanism.

  • PortNumber (OBSOLETE)

    This formerly specified the port number to be used for listening for connections from other nodes. This parameter should no longer be used; use the ServerPort data node configuration parameter for this purpose instead.

  • ReceiveBufferMemory

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.0.4bytes2M16K - 4G
    Restart Type: N

    Specifies the size of the buffer used when receiving data from the TCP/IP socket.

    The default value of this parameter is 2MB. The minimum possible value is 16KB; the theoretical maximum is 4GB.

17.3.2.9. MySQL Cluster TCP/IP Connections Using Direct Connections

Setting up a cluster using direct connections between data nodes requires specifying explicitly the crossover IP addresses of the data nodes so connected in the [tcp] section of the cluster config.ini file.

In the following example, we envision a cluster with at least four hosts, one each for a management server, an SQL node, and two data nodes. The cluster as a whole resides on the 172.23.72.* subnet of a LAN. In addition to the usual network connections, the two data nodes are connected directly using a standard crossover cable, and communicate with one another directly using IP addresses in the 1.1.0.* address range as shown:

# Management Server[ndb_mgmd]Id=1HostName=172.23.72.20# SQL Node[mysqld]Id=2HostName=172.23.72.21# Data Nodes[ndbd]Id=3HostName=172.23.72.22[ndbd]Id=4HostName=172.23.72.23# TCP/IP Connections[tcp]NodeId1=3NodeId2=4HostName1=1.1.0.1HostName2=1.1.0.2

The HostName1 and HostName2 parameters are used only when specifying direct connections.

The use of direct TCP connections between data nodes can improve the cluster's overall efficiency by enabling the data nodes to bypass an Ethernet device such as a switch, hub, or router, thus cutting down on the cluster's latency. It is important to note that to take the best advantage of direct connections in this fashion with more than two data nodes, you must have a direct connection between each data node and every other data node in the same node group.

17.3.2.10. MySQL Cluster Shared-Memory Connections

MySQL Cluster attempts to use the shared memory transporter and configure it automatically where possible. [shm] sections in the config.ini file explicitly define shared-memory connections between nodes in the cluster. When explicitly defining shared memory as the connection method, it is necessary to define at least NodeId1, NodeId2, and ShmKey. All other parameters have default values that should work well in most cases.

Important

SHM functionality is considered experimental only. It is not officially supported in any current MySQL Cluster release, and testing results indicate that SHM performance is not appreciably greater than when using TCP/IP for the transporter.

For these reasons, you must determine for yourself or by using our free resources (forums, mailing lists) whether SHM can be made to work correctly in your specific case.

  • NodeId1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    NodeId2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    To identify a connection between two nodes it is necessary to provide node identifiers for each of them, as NodeId1 and NodeId2.

  • HostName1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    HostName2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    The HostName1 and HostName2 parameters can be used to specify specific network interfaces to be used for a given SHM connection between two nodes. The values used for these parameters can be hostnames or IP addresses.

  • ShmKey

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]0 - 4G
    Restart Type: N

    When setting up shared memory segments, a node ID, expressed as an integer, is used to identify uniquely the shared memory segment to use for the communication. There is no default value.

  • ShmSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0bytes1M64K - 4G
    Restart Type: N

    Each SHM connection has a shared memory segment where messages between nodes are placed by the sender and read by the reader. The size of this segment is defined by ShmSize. The default value is 1MB.

  • SendSignalId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0booleanfalsetrue, false
    Restart Type: N

    To retrace the path of a distributed message, it is necessary to provide each message with a unique identifier. Setting this parameter to Y causes these message IDs to be transported over the network as well. This feature is disabled by default in production builds, and enabled in -debug builds.

  • Checksum

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0booleantruetrue, false
    Restart Type: N

    This parameter is a boolean (Y/N) parameter which is disabled by default. When it is enabled, checksums for all messages are calculated before being placed in the send buffer.

    This feature prevents messages from being corrupted while waiting in the send buffer. It also serves as a check against data being corrupted during transport.

  • SigNum

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]0 - 4G
    Restart Type: N

    When using the shared memory transporter, a process sends an operating system signal to the other process when there is new data available in the shared memory. Should that signal conflict with with an existing signal, this parameter can be used to change it. This is a possibility when using SHM due to the fact that different operating systems use different signal numbers.

    The default value of SigNum is 0; therefore, it must be set to avoid errors in the cluster log when using the shared memory transporter. Typically, this parameter is set to 10 in the [shm default] section of the config.ini file.

17.3.2.11. SCI Transport Connections in MySQL Cluster

[sci] sections in the config.ini file explicitly define SCI (Scalable Coherent Interface) connections between cluster nodes. Using SCI transporters in MySQL Cluster is supported only when the MySQL binaries are built using --with-ndb-sci=/your/path/to/SCI. The path should point to a directory that contains at a minimum lib and include directories containing SISCI libraries and header files. (See Section 17.3.5, "Using High-Speed Interconnects with MySQL Cluster" for more information about SCI.)

In addition, SCI requires specialized hardware.

It is strongly recommended to use SCI Transporters only for communication between ndbd processes. Note also that using SCI Transporters means that the ndbd processes never sleep. For this reason, SCI Transporters should be used only on machines having at least two CPUs dedicated for use by ndbd processes. There should be at least one CPU per ndbd process, with at least one CPU left in reserve to handle operating system activities.

  • NodeId1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    NodeId2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0numeric[none]...
    Restart Type: N

    To identify a connection between two nodes it is necessary to provide node identifiers for each of them, as NodeId1 and NodeId2.

  • Host1SciId0

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]0 - 4G
    Restart Type: N

    This identifies the SCI node ID on the first Cluster node (identified by NodeId1).

  • Host1SciId1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned00 - 4G
    Restart Type: N

    It is possible to set up SCI Transporters for failover between two SCI cards which then should use separate networks between the nodes. This identifies the node ID and the second SCI card to be used on the first node.

  • Host2SciId0

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned[none]0 - 4G
    Restart Type: N

    This identifies the SCI node ID on the second Cluster node (identified by NodeId2).

  • Host2SciId1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned00 - 4G
    Restart Type: N

    When using two SCI cards to provide failover, this parameter identifies the second SCI card to be used on the second node.

  • HostName1

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    HostName2

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0name or IP address[none]...
    Restart Type: N

    The HostName1 and HostName2 parameters can be used to specify specific network interfaces to be used for a given SCI connection between two nodes. The values used for these parameters can be hostnames or IP addresses.

  • SharedBufferSize

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned10M64K - 4G
    Restart Type: N

    Each SCI transporter has a shared memory segment used for communication between the two nodes. Setting the size of this segment to the default value of 1MB should be sufficient for most applications. Using a smaller value can lead to problems when performing many parallel inserts; if the shared buffer is too small, this can also result in a crash of the ndbd process.

  • SendLimit

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0unsigned8K128 - 32K
    Restart Type: N

    A small buffer in front of the SCI media stores messages before transmitting them over the SCI network. By default, this is set to 8KB. Our benchmarks show that performance is best at 64KB but 16KB reaches within a few percent of this, and there was little if any advantage to increasing it beyond 8KB.

  • SendSignalId

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.3.23booleantruetrue, false
    Restart Type: N

    To trace a distributed message it is necessary to identify each message uniquely. When this parameter is set to Y, message IDs are transported over the network. This feature is disabled by default in production builds, and enabled in -debug builds.

  • Checksum

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 7.2.0booleanfalsetrue, false
    Restart Type: N

    This parameter is a boolean value, and is disabled by default. When Checksum is enabled, checksums are calculated for all messages before they are placed in the send buffer. This feature prevents messages from being corrupted while waiting in the send buffer. It also serves as a check against data being corrupted during transport.

  • OverloadLimit

    Effective VersionType/UnitsDefaultRange or Permitted Values
    NDB 6.4.0bytes00 - 4G
    Restart Type: N

    When more than this many unsent bytes are in the send buffer, the connection is considered overloaded. See Section 17.3.2.12, "Configuring MySQL Cluster Send Buffer Parameters", for more information.

17.3.2.12. Configuring MySQL Cluster Send Buffer Parameters

Formerly, the NDB kernel employed a send buffer whose size was fixed at 2MB for each node in the cluster, this buffer being allocated when the node started. Because the size of this buffer could not be changed after the cluster was started, it was necessary to make it large enough in advance to accommodate the maximum possible load on any transporter socket. However, this was an inefficient use of memory, since much of it often went unused, and could result in large amounts of resources being wasted when scaling up to many API nodes.

This problem was eventually solved (in MySQL Cluster NDB 7.0) by employing a unified send buffer whose memory is allocated dynamically from a pool shared by all transporters. This means that the size of the send buffer can be adjusted as necessary. Configuration of the unified send buffer can accomplished by setting the following parameters:

  • TotalSendBufferMemory. This parameter can be set for all types of MySQL Cluster nodes-that is, it can be set in the [ndbd], [mgm], and [api] (or [mysql]) sections of the config.ini file. It represents the total amount of memory (in bytes) to be allocated by each node for which it is set for use among all configured transporters. If set, its minimum is 256KB; the maximum is 4294967039.

    To be backward-compatible with existing configurations, this parameter takes as its default value the sum of the maximum send buffer sizes of all configured transporters, plus an additional 32KB (one page) per transporter. The maximum depends on the type of transporter, as shown in the following table:

    TransporterMaxmimum Send Buffer Size (bytes)
    TCPSendBufferMemory (default = 2M)
    SCISendLimit (default = 8K) plus 16K
    SHM20K

    This enables existing configurations to function in close to the same way as they did with MySQL Cluster NDB 6.3 and earlier, with the same amount of memory and send buffer space available to each transporter. However, memory that is unused by one transporter is not available to other transporters.

  • OverloadLimit. This parameter is used in the config.ini file [tcp] section, and denotes the amount of unsent data (in bytes) that must be present in the send buffer before the connection is considered overloaded. When such an overload condition occurs, transactions that affect the overloaded connection fail with NDB API Error 1218 (Send Buffers overloaded in NDB kernel) until the overload status passes. The default value is 0, in which case the effective overload limit is calculated as SendBufferMemory * 0.8 for a given connection. The maximum value for this parameter is 4G.

  • SendBufferMemory. This value denotes a hard limit for the amount of memory that may be used by a single transporter out of the entire pool specified by TotalSendBufferMemory. However, the sum of SendBufferMemory for all configured transporters may be greater than the TotalSendBufferMemory that is set for a given node. This is a way to save memory when many nodes are in use, as long as the maximum amount of memory is never required by all transporters at the same time.

Copyright © 1997, 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices
(Sebelumnya) 17. MySQL Cluster NDB 7.217.3.3. Overview of MySQL Clus ... (Berikutnya)