21.4 Configuration of NDB Cluster

A MySQL server that is part of an NDB Cluster differs in one chief respect from a normal (nonclustered) MySQL server, in that it employs the note 'NDB': mysql-cluster. storage engine. This engine is also referred to sometimes as note 'NDBCLUSTER': mysql-cluster, although 'NDB' is preferred.

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

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

For more information about '--ndbcluster' and other note 'mysqld': mysqld. options specific to NDB Cluster, see note mysql-cluster-program-options-mysqld::.

For general information about installing NDB Cluster, see *note mysql-cluster-installation::.

 File: manual.info.tmp, Node: mysql-cluster-quick, Next: mysql-cluster-configuration-overview, Prev: mysql-cluster-configuration, Up: mysql-cluster-configuration

21.4.1 Quick Test Setup of NDB Cluster

To familiarize you with the basics, we describe the simplest possible configuration for a functional NDB 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:

 $> 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 do not know the hostname for your machine, use localhost.
 # The DataDir parameter also has a default value, but it is recommended to
 # set it explicitly.
 # [api] and [mgm] are aliases for [mysqld] and [ndb_mgmd], respectively.

 [ndbd default]
 NoOfReplicas= 1

 [mysqld  default]
 [ndb_mgmd default]
 [tcp default]

 [ndb_mgmd]
 HostName= myhost.example.com

 [ndbd]
 HostName= myhost.example.com
 DataDir= /var/lib/mysql-cluster

 [mysqld]
 [mysqld]
 [mysqld]

You can now start the note 'ndb_mgmd': mysql-cluster-programs-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 note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd.:

 $> cd /var/lib/mysql-cluster
 $> ndb_mgmd

Then start a single data node by running *note 'ndbd': mysql-cluster-programs-ndbd.:

 $> ndbd

By default, *note 'ndbd': mysql-cluster-programs-ndbd. looks for the management server at 'localhost' on port 1186.

Note:

If you have installed MySQL from a binary tarball, you must specify the path of the note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd. and note 'ndbd': mysql-cluster-programs-ndbd. servers explicitly. (Normally, these can 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:

 $> 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 *note 'NDBCLUSTER': mysql-cluster. storage engine is enabled:

 $> mysql
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 1 to server version: 5.7.44

 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 mysql> SHOW ENGINES\G
 ...
 *************************** 12. row ***************************
 Engine: NDBCLUSTER
 Support: YES
 Comment: Clustered, fault-tolerant, memory-based tables
 *************************** 13. row ***************************
 Engine: NDB
 Support: YES
 Comment: 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 *note 'NDBCLUSTER': mysql-cluster. table:

 $> mysql
 mysql> USE test;
 Database changed

 mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
 Query OK, 0 rows affected (0.09 sec)

 mysql> SHOW CREATE TABLE ctest \G
 *************************** 1. row ***************************
        Table: ctest
 Create Table: CREATE TABLE `ctest` (
   `i` int(11) default NULL
 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 1 row in set (0.00 sec)

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

 $> ndb_mgm

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

 ndb_mgm> SHOW
 Cluster Configuration
 ---------------------
 [ndbd(NDB)]     1 node(s)
 id=2    @127.0.0.1  (Version: 5.7.44-ndb-7.5.36, Nodegroup: 0, *)

 [ndb_mgmd(MGM)] 1 node(s)
 id=1    @127.0.0.1  (Version: 5.7.44-ndb-7.5.36)

 [mysqld(API)]   3 node(s)
 id=3    @127.0.0.1  (Version: 5.7.44-ndb-7.5.36)
 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 NDB Cluster . You can now store data in the cluster by using any table created with 'ENGINE=NDBCLUSTER' or its alias 'ENGINE=NDB'.

 File: manual.info.tmp, Node: mysql-cluster-configuration-overview, Next: mysql-cluster-config-file, Prev: mysql-cluster-quick, Up: mysql-cluster-configuration

21.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables

The next several sections provide summary tables of NDB Cluster node configuration parameters used in the 'config.ini' file to govern various aspects of node behavior, as well as of options and variables read by *note 'mysqld': mysqld. from a 'my.cnf' file or from the command line when run as an NDB Cluster process. Each of the node parameter tables lists the parameters for a given type ('ndbd', 'ndb_mgmd', 'mysqld', 'computer', 'tcp', or 'shm'). All tables include the data type for the parameter, option, or variable, as well as its default, mimimum, and maximum values as applicable.

Considerations when restarting nodes

For node parameters, these tables also indicate what type of restart is required (node restart or system restart)--and whether the restart must be done with '--initial'--to change the value of a given configuration parameter. When performing a node restart or an initial node restart, all of the cluster's data nodes must be restarted in turn (also referred to as a rolling restart). It is possible to update cluster configuration parameters marked as 'node' online--that is, without shutting down the cluster--in this fashion. An initial node restart requires restarting each *note 'ndbd': mysql-cluster-programs-ndbd. process with the '--initial' option.

A system restart requires a complete shutdown and restart of the entire cluster. An initial system restart requires taking a backup of the cluster, wiping the cluster file system after shutdown, and then restoring from the backup following the restart.

In any cluster restart, all of the cluster's management servers must be restarted for them to read the updated configuration parameter values.

Important:

Values for numeric cluster parameters can generally be increased without any problems, although it is advisable to do so progressively, making such adjustments in relatively small increments. Many of these can be increased online, using a rolling restart.

However, decreasing the values of such parameters--whether this is done using a node restart, node initial restart, or even a complete system restart of the cluster--is not to be undertaken lightly; it is recommended that you do so only after careful planning and testing. This is especially true with regard to those parameters that relate to memory usage and disk space, such as 'MaxNoOfTables', 'MaxNoOfOrderedIndexes', and 'MaxNoOfUniqueHashIndexes'. In addition, it is the generally the case that configuration parameters relating to memory and disk usage can be raised using a simple node restart, but they require an initial node restart to be lowered.

Because some of these parameters can be used for configuring more than one type of cluster node, they may appear in more than one of the tables.

Note:

'4294967039' often appears as a maximum value in these tables. This value is defined in the *note 'NDBCLUSTER': mysql-cluster. sources as 'MAX_INT_RNIL' and is equal to '0xFFFFFEFF', or '2^32 − 2^8 − 1'.

 File: manual.info.tmp, Node: mysql-cluster-params-ndbd, Next: mysql-cluster-params-mgmd, Prev: mysql-cluster-configuration-overview, Up: mysql-cluster-configuration-overview

21.4.2.1 NDB Cluster Data Node Configuration Parameters .......................................................

The listings in this section provide information about parameters used in the '[ndbd]' or '[ndbd default]' sections of a 'config.ini' file for configuring NDB Cluster data nodes. For detailed descriptions and other additional information about each of these parameters, see *note mysql-cluster-ndbd-definition::.

These parameters also apply to note 'ndbmtd': mysql-cluster-programs-ndbmtd, the multithreaded version of note 'ndbd': mysql-cluster-programs-ndbd. A separate listing of parameters specific to *note 'ndbmtd': mysql-cluster-programs-ndbmtd. follows.

The following parameters are specific to *note 'ndbmtd': mysql-cluster-programs-ndbmtd.:

 File: manual.info.tmp, Node: mysql-cluster-params-mgmd, Next: mysql-cluster-params-api, Prev: mysql-cluster-params-ndbd, Up: mysql-cluster-configuration-overview

21.4.2.2 NDB Cluster Management Node Configuration Parameters .............................................................

The listing in this section provides information about parameters used in the '[ndb_mgmd]' or '[mgm]' section of a 'config.ini' file for configuring NDB Cluster management nodes. For detailed descriptions and other additional information about each of these parameters, see *note mysql-cluster-mgm-definition::.

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. See *note mysql-cluster-mgm-definition::, for more information.

To add new management servers to a running NDB Cluster, it is also necessary 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 *note mysql-cluster-limitations-multiple-nodes::.

 File: manual.info.tmp, Node: mysql-cluster-params-api, Next: mysql-cluster-params-other, Prev: mysql-cluster-params-mgmd, Up: mysql-cluster-configuration-overview

21.4.2.3 NDB Cluster SQL Node and API Node Configuration Parameters ...................................................................

The listing in this section provides information about parameters used in the '[mysqld]' and '[api]' sections of a 'config.ini' file for configuring NDB Cluster SQL nodes and API nodes. For detailed descriptions and other additional information about each of these parameters, see *note mysql-cluster-api-definition::.

For a discussion of MySQL server options for NDB Cluster, see note mysql-cluster-program-options-mysqld::. For information about MySQL server system variables relating to NDB Cluster, see note mysql-cluster-system-variables::.

Note:

To add new SQL or API nodes to the configuration of a running NDB 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.

 File: manual.info.tmp, Node: mysql-cluster-params-other, Next: mysql-cluster-option-tables, Prev: mysql-cluster-params-api, Up: mysql-cluster-configuration-overview

21.4.2.4 Other NDB Cluster Configuration Parameters ...................................................

The listings in this section provide information about parameters used in the '[computer]', '[tcp]', and '[shm]' sections of a 'config.ini' file for configuring NDB Cluster. For detailed descriptions and additional information about individual parameters, see note mysql-cluster-tcp-definition::, or note mysql-cluster-shm-definition::, as appropriate.

The following parameters apply to the 'config.ini' file's '[computer]' section:

The following parameters apply to the 'config.ini' file's '[tcp]' section:

The following parameters apply to the 'config.ini' file's '[shm]' section:

 File: manual.info.tmp, Node: mysql-cluster-option-tables, Prev: mysql-cluster-params-other, Up: mysql-cluster-configuration-overview

21.4.2.5 NDB Cluster mysqld Option and Variable Reference .........................................................

The following list includes command-line options, system variables, and status variables applicable within 'mysqld' when it is running as an SQL node in an NDB Cluster. For a reference to all command-line options, system variables, and status variables used with or relating to note 'mysqld': mysqld, see note server-option-variable-reference::.

 File: manual.info.tmp, Node: mysql-cluster-config-file, Next: mysql-cluster-interconnects, Prev: mysql-cluster-configuration-overview, Up: mysql-cluster-configuration

21.4.3 NDB Cluster Configuration Files

Configuring NDB Cluster requires working with two files:

Caching of configuration data

'NDB' 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:

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 NDB Cluster from source on a Unix system, the default location is '/usr/local/mysql-cluster'.) This can be overridden at runtime 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', '--config-cache', '--initial', and '--reload' options for the NDB Cluster management server, see *note mysql-cluster-programs-ndb-mgmd::.

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 try to let NDB 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 *note bug-reports::.

 File: manual.info.tmp, Node: mysql-cluster-config-example, Next: mysql-cluster-config-starting, Prev: mysql-cluster-config-file, Up: mysql-cluster-config-file

21.4.3.1 NDB Cluster Configuration: Basic Example .................................................

To support NDB Cluster, you must 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 NDB Cluster
 # (valid in MySQL 5.7)

 # enable ndbcluster storage engine, and provide connection string for
 # management server host (default port is 1186)
 [mysqld]
 ndbcluster
 ndb-connectstring=ndb_mgmd.mysql.com

 # provide connection string for management server host (default port: 1186)
 [ndbd]
 connect-string=ndb_mgmd.mysql.com

 # provide connection string for management server host (default port: 1186)
 [ndb_mgm]
 connect-string=ndb_mgmd.mysql.com

 # provide location of cluster configuration file
 # IMPORTANT: When starting the management server with this option in the
 # configuration file, the use of --initial or --reload on the command line when
 # invoking ndb_mgmd is also required.
 [ndb_mgmd]
 config-file=/etc/config.ini

(For more information on connection strings, see *note mysql-cluster-connection-strings::.)

 # my.cnf
 # example additions to my.cnf for NDB Cluster
 # (works on all versions)

 # enable ndbcluster storage engine, and provide connection string for management
 # server host to the default port 1186
 [mysqld]
 ndbcluster
 ndb-connectstring=ndb_mgmd.mysql.com:1186

Important:

Once you have started a note 'mysqld': mysqld. process with the note 'NDBCLUSTER': mysql-cluster. and 'ndb-connectstring' parameters in the '[mysqld]' in the 'my.cnf' file as shown previously, you cannot execute any note 'CREATE TABLE': create-table. or note 'ALTER TABLE': alter-table. statements without having actually started the cluster. Otherwise, these statements 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 note 'NDB': mysql-cluster. variables that can be set in the 'my.cnf' file, see note mysql-cluster-system-variables::.

The NDB Cluster global configuration file is by convention named 'config.ini' (but this is not required). If needed, it is read by note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd. at startup and can be placed in any location that can be read by it. The location and name of the configuration are specified using '--config-file=PATH_NAME' with note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd. on the command line. This option has no default value, and is ignored if *note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd. uses the configuration cache.

The global configuration file for NDB 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.

If used, the '[ndbd default]' section must precede any '[ndbd]' sections in the configuration file. This is also true for 'default' sections of any other type.

Note:

In some older releases of NDB 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= 2
 DataDir= /var/lib/mysql-cluster

 [ndb_mgmd]
 Hostname= ndb_mgmd.mysql.com
 DataDir= /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 NDB Cluster , and is almost certain not to be sufficient for production settings. See *note mysql-cluster-config-starting::, 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. If used, a 'default' section should come before any other sections of that type. For example, an '[ndbd default]' section should appear in the configuration file before any '[ndbd]' sections.

NDB Cluster parameter names are case-insensitive, unless specified in MySQL Server 'my.cnf' or 'my.ini' files.

 File: manual.info.tmp, Node: mysql-cluster-config-starting, Next: mysql-cluster-connection-strings, Prev: mysql-cluster-config-example, Up: mysql-cluster-config-file

21.4.3.2 Recommended Starting Configuration for NDB Cluster ...........................................................

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

Therefore, obtaining an optimum configuration is likely to be an iterative process, the outcome of which can vary widely with the specifics of each NDB 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 NDB 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 NDB Cluster 7.5:

 # TCP PARAMETERS

 [tcp default]
 SendBufferMemory=2M
 ReceiveBufferMemory=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 is 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 two fragment replicas is recommended to guarantee availability of data;
 # using only one fragment 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 two fragment replicas, since
 # two are 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=3072M
 IndexMemory=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 *note ndb_size.pl: mysql-cluster-programs-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.
 # NOTE: IndexMemory is deprecated in NDB 7.6 and later.

 # 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 NDB Cluster on systems running
 # Linux kernel 2.6 or later.

 NoOfFragmentLogFiles=300
 DataDir=PATH/TO/DATA/NODE/DATA/DIRECTORY
 MaxNoOfConcurrentOperations=100000

 SchedulerSpinTimer=400
 SchedulerExecutionTimer=100
 RealTimeScheduler=1
 # Setting these parameters allows you to take advantage of real-time scheduling
 # of NDB threads to achieve increased throughput when using *note ndbd: mysql-cluster-programs-ndbd. They
 # are not needed when using *note ndbmtd: mysql-cluster-programs-ndbmtd.; in particular, you should not set
 # RealTimeScheduler for *note ndbmtd: mysql-cluster-programs-ndbmtd. data nodes.

 TimeBetweenGlobalCheckpoints=1000
 TimeBetweenEpochs=200
 RedoBuffer=32M

 # CompressedLCP=1
 # CompressedBackup=1
 # Enabling CompressedLCP and CompressedBackup causes, respectively, local
 checkpoint files and backup files to be compressed, which can result in a space
 savings of up to 50% over noncompressed LCPs and backups.

 # MaxNoOfLocalScans=64
 MaxNoOfTables=1024
 MaxNoOfOrderedIndexes=256

 [ndbd]
 HostName=DATA-NODE-A-HOSTNAME
 # NodeId=DATA-NODE-A-NODEID

 LockExecuteThreadToCPU=1
 LockMaintThreadsToCPU=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-NODEID

 LockExecuteThreadToCPU=1
 LockMaintThreadsToCPU=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.

Required my.cnf options for SQL nodes

MySQL servers acting as NDB Cluster SQL nodes must always be started with the '--ndbcluster' and '--ndb-connectstring' options, either on the command line or in 'my.cnf'.

 File: manual.info.tmp, Node: mysql-cluster-connection-strings, Next: mysql-cluster-computer-definition, Prev: mysql-cluster-config-starting, Up: mysql-cluster-config-file

21.4.3.3 NDB Cluster Connection Strings .......................................

With the exception of the NDB Cluster management server (*note 'ndb_mgmd': mysql-cluster-programs-ndb-mgmd.), each node that is part of an NDB Cluster requires a connection string that points to the management server's location. This connection string 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 connection string is as follows:

 [nodeid=NODE_ID, ]HOST-DEFINITION[, HOST-DEFINITION[, ...]]

 HOST-DEFINITION:
     HOST_NAME[:PORT_NUMBER]

'node_id' is an integer greater than or equal to 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,198.51.100.3:1200"
 example 2 (short):   "myhost1"

'localhost:1186' is used as the default connection string value if none is provided. If PORT_NUM is omitted from the connection string, 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. An NDB 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 connection string 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 connection strings 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 connection string 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 connection string causes the node to use '198.51.100.242' regardless of the management server to which it connects:

 bind-address=198.51.100.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 connection string:

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

In this case, the node uses 'localhost' to connect to the management server running on the host named 'poseidon' and '198.51.100.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 '198.51.100.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=198.51.100.242,poseidon:1186;bind-address=localhost,perch:1186,orca:2200

There are a number of different ways to specify the connection string:

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

 File: manual.info.tmp, Node: mysql-cluster-computer-definition, Next: mysql-cluster-mgm-definition, Prev: mysql-cluster-connection-strings, Up: mysql-cluster-config-file

21.4.3.4 Defining Computers in an NDB 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.

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-mgm-definition, Next: mysql-cluster-ndbd-definition, Prev: mysql-cluster-computer-definition, Up: mysql-cluster-config-file

21.4.3.5 Defining an NDB Cluster Management Server ..................................................

The '[ndb_mgmd]' section is used to configure the behavior of the management server. If multiple management servers are employed, you can specify parameters common to all of them in an '[ndb_mgmd default]' section. '[mgm]' and '[mgm default]' are older aliases for these, supported for backward compatibility.

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' is assumed for both.

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 NDB 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 *note mysql-cluster-limitations-multiple-nodes::.

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-ndbd-definition, Next: mysql-cluster-api-definition, Prev: mysql-cluster-mgm-definition, Up: mysql-cluster-config-file

21.4.3.6 Defining NDB 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 note 'ndbd': mysql-cluster-programs-ndbd. or note 'ndbmtd': mysql-cluster-programs-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 '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' and 'NodeId' 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, 1024x1024, or 1024x1024x1024. (For example, '100K' means 100 x 1024 = 102400.)

Parameter names and values are case-insensitive, unless used in a MySQL Server 'my.cnf' or 'my.ini' file, in which case they are case-sensitive.

Information about configuration parameters specific to NDB Cluster Disk Data tables can be found later in this section (see *note mysql-cluster-ndbd-definition-disk-data-parameters::).

All of these parameters also apply to note 'ndbmtd': mysql-cluster-programs-ndbmtd. (the multithreaded version of note 'ndbd': mysql-cluster-programs-ndbd.). Three additional data node configuration parameters--'MaxNoOfExecutionThreads', 'ThreadConfig', and 'NoOfFragmentLogParts'--apply to note 'ndbmtd': mysql-cluster-programs-ndbmtd. only; these have no effect when used with note 'ndbd': mysql-cluster-programs-ndbd. For more information, see note mysql-cluster-ndbd-definition-ndbmtd-parameters::. See also note mysql-cluster-programs-ndbmtd::.

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.

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.

Note:

'IndexMemory' is deprecated in NDB 7.6, and subject to removal in a future version of NDB Cluster. See the descriptions that follow for further information.

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 NDB 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 fragment replicas, there are two node groups. Thus, the total data memory available is 2 x '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 in NDB 7.5 and earlier 'IndexMemory') can be changed, but decreasing it can be risky; doing so can easily lead to a node or even an entire NDB Cluster that is unable to restart due to there being insufficient memory space. Increases 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.

MinFreePct

A proportion (5% by default) of data node resources including 'DataMemory' (and in NDB 7.5 and earlier, '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).

Version (or later)

NDB 7.5.0

Type or units

unsigned

Default

5

Range

0 - 100

Restart Type

Node Restart: Requires a *note rolling restart: mysql-cluster-rolling-restart. of the cluster. (NDB 7.5.0)

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.

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.

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

Memory Allocation

'MaxAllocate'

Version (or later)

NDB 7.5.0

Type or units

unsigned

Default

32M

Range

1M - 1G

Deprecated

Yes (in NDB 8.0)

Restart Type

Node Restart: Requires a *note rolling restart: mysql-cluster-rolling-restart. of the cluster. (NDB 7.5.0)

This parameter was used in older versions of NDB Cluster, but has no effect in NDB 7.5 or NDB 7.6.

Hash Map Size

'DefaultHashMapSize'

Version (or later)

NDB 7.5.0

Type or units

LDM threads

Default

240

Range

0 - 3840

Restart Type

Node Restart: Requires a *note rolling restart: mysql-cluster-rolling-restart. of the cluster. (NDB 7.5.0)

The size of the table hash maps used by *note 'NDB': mysql-cluster. is configurable using this parameter. 'DefaultHashMapSize' can take any of three possible values (0, 240, 3840).

The original intended use for this parameter was to facilitate upgrades and especially downgrades to and from very old releases with differing default hash map sizes. This is not an issue when upgrading from NDB Cluster 7.3 (or later) to later versions.

Decreasing this parameter online after any tables have been created or modified with 'DefaultHashMapSize' equal to 3840 is not supported.

Logging and checkpointing

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

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:

These act merely as 'suggestions' to the cluster, and any that are not specified revert to the default values shown.

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

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.

The heartbeat interval between management nodes and data nodes is always 100 milliseconds, and is not configurable.

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 *note 'NDB': mysql-cluster. storage engine's file system abstraction layer.

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

Data Node Debugging Parameters

The following parameters are intended for use during testing or debugging of data nodes, and not for use in production.

Backup parameters

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

Note:

The location of the backup files is determined by the 'BackupDataDir' data node configuration parameter.

Additional requirements

When specifying these parameters, the following relationships must hold true. Otherwise, the data node cannot start.

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

Multi-Threading Configuration Parameters (ndbmtd)

note 'ndbmtd': mysql-cluster-programs-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. A second method makes it possible to set up more complex rules for note 'ndbmtd': mysql-cluster-programs-ndbmtd. multithreading using 'ThreadConfig'. The next few paragraphs provide information about these parameters and their use with multithreaded data nodes.

Disk Data Configuration Parameters

Configuration parameters affecting Disk Data behavior include the following:

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 *note mysql-cluster-config-send-buffers::.

See also *note mysql-cluster-online-add-node::.

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:

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 listed here:

NDB index statistics parameters

The parameters in the following list relate to NDB index statistics generation.

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-api-definition, Next: mysql-cluster-system-definition, Prev: mysql-cluster-ndbd-definition, Up: mysql-cluster-config-file

21.4.3.7 Defining SQL and Other API Nodes in an NDB 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 *note 'mysqld': 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 NDB Cluster, see note mysql-cluster-program-options-mysqld::. For information about MySQL server system variables relating to NDB Cluster, see note mysql-cluster-system-variables::.

API Node Debugging Parameters

You can use the 'ApiVerbose' configuration parameter to enable debugging output from a given API node. This parameter takes an integer value. 0 is the default, and disables such debugging; 1 enables debugging output to the cluster log; 2 adds 'DBDICT' (https://dev.mysql.com/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbdict.html) debugging output as well. (Bug #20638450) See also DUMP 1229 (https://dev.mysql.com/doc/ndb-internals/en/dump-command-1229.html).

You can also obtain information from a MySQL server running as an NDB Cluster SQL node using note 'SHOW STATUS': show-status. in the note 'mysql': mysql. client, as shown here:

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

For information about the status variables appearing in the output from this statement, see *note mysql-cluster-status-variables::.

Note:

To add new SQL or API nodes to the configuration of a running NDB 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.

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-system-definition, Next: mysql-cluster-options-variables, Prev: mysql-cluster-api-definition, Up: mysql-cluster-config-file

21.4.3.8 Defining the System ............................

The '[system]' section is used for parameters applying to the cluster as a whole. The 'Name' system parameter is used with MySQL Enterprise Monitor; 'ConfigGenerationNumber' and 'PrimaryMGMNode' are not used in production environments. Except when using NDB Cluster with MySQL Enterprise Monitor, is not necessary to have a '[system]' section in the 'config.ini' file.

More information about these parameters can be found in the following list:

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-options-variables, Next: mysql-cluster-tcp-definition, Prev: mysql-cluster-system-definition, Up: mysql-cluster-config-file

21.4.3.9 MySQL Server Options and Variables for NDB Cluster ...........................................................

This section provides information about MySQL server options, server and status variables that are specific to NDB Cluster. For general information on using these, and for other options and variables not specific to NDB Cluster, see *note mysqld-server::.

For NDB Cluster configuration parameters used in the cluster configuration file (usually named 'config.ini'), see *note mysql-cluster-configuration::.

 File: manual.info.tmp, Node: mysql-cluster-program-options-mysqld, Next: mysql-cluster-system-variables, Prev: mysql-cluster-options-variables, Up: mysql-cluster-options-variables

21.4.3.10 MySQL Server Options for NDB Cluster ..............................................

This section provides descriptions of note 'mysqld': mysqld. server options relating to NDB Cluster. For information about note 'mysqld': mysqld. options not specific to NDB Cluster, and for general information about the use of options with note 'mysqld': mysqld, see note server-options::.

For information about command-line options used with other NDB Cluster processes, see *note mysql-cluster-programs::.

 File: manual.info.tmp, Node: mysql-cluster-system-variables, Next: mysql-cluster-status-variables, Prev: mysql-cluster-program-options-mysqld, Up: mysql-cluster-options-variables

21.4.3.11 NDB Cluster System Variables ......................................

This section provides detailed information about MySQL server system variables that are specific to NDB Cluster and the note 'NDB': mysql-cluster. storage engine. For system variables not specific to NDB Cluster, see note server-system-variables::. For general information on using system variables, see *note using-system-variables::.

The system variables in the following list all relate to the *note 'ndbinfo': mysql-cluster-ndbinfo. information database.

 File: manual.info.tmp, Node: mysql-cluster-status-variables, Prev: mysql-cluster-system-variables, Up: mysql-cluster-options-variables

21.4.3.12 NDB Cluster Status Variables ......................................

This section provides detailed information about MySQL server status variables that relate to NDB Cluster and the note 'NDB': mysql-cluster. storage engine. For status variables not specific to NDB Cluster, and for general information on using status variables, see note server-status-variables::.

 File: manual.info.tmp, Node: mysql-cluster-tcp-definition, Next: mysql-cluster-tcp-definition-direct, Prev: mysql-cluster-options-variables, Up: mysql-cluster-config-file

21.4.3.13 NDB Cluster TCP/IP Connections ........................................

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

Note:

For an exception to this rule, see *note mysql-cluster-tcp-definition-direct::.

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 NDB 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 NDB Cluster management server.

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

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-tcp-definition-direct, Next: mysql-cluster-shm-definition, Prev: mysql-cluster-tcp-definition, Up: mysql-cluster-config-file

21.4.3.14 NDB 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=1
 HostName=172.23.72.20

 # SQL Node
 [mysqld]
 Id=2
 HostName=172.23.72.21

 # Data Nodes
 [ndbd]
 Id=3
 HostName=172.23.72.22

 [ndbd]
 Id=4
 HostName=172.23.72.23

 # TCP/IP Connections
 [tcp]
 NodeId1=3
 NodeId2=4
 HostName1=1.1.0.1
 HostName2=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.

Note:

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.

 File: manual.info.tmp, Node: mysql-cluster-shm-definition, Next: mysql-cluster-config-send-buffers, Prev: mysql-cluster-tcp-definition-direct, Up: mysql-cluster-config-file

21.4.3.15 NDB Cluster Shared Memory Connections ...............................................

Communications between NDB cluster nodes are normally handled using TCP/IP. The shared memory (SHM) transporter is distinguished by the fact that signals are transmitted by writing in memory rather than on a socket. The shared-memory transporter (SHM) can improve performance by negating up to 20% of the overhead required by a TCP connection when running an API node (usually an SQL node) and a data node together on the same host. You can enable a shared memory connection in either of the two ways listed here:

Suppose a cluster is running a data node which has node ID 1 and an SQL node having node ID 51 on the same host computer at 10.0.0.1. To enable an SHM connection between these two nodes, all that is necessary is to insure that the following entries are included in the cluster configuration file:

 [ndbd]
 NodeId=1
 HostName=10.0.0.1
 UseShm=1

 [mysqld]
 NodeId=51
 HostName=10.0.0.1

Important:

The two entries just shown are in addition to any other entries and parameter settings needed by the cluster. A more complete example is shown later in this section.

Before starting data nodes that use SHM connections, it is also necessary to make sure that the operating system on each computer hosting such a data node has sufficient memory allocated to shared memory segments. See the documentation for your operating platform for information regarding this. In setups where multiple hosts are each running a data node and an API node, it is possible to enable shared memory on all such hosts by setting 'UseShm' in the '[ndbd default]' section of the configuration file. This is shown in the example later in this section.

While not strictly required, tuning for all SHM connections in the cluster can be done by setting one or more of the following parameters in the '[shm default]' section of the cluster configuration ('config.ini') file:

This example shows a simple setup with SHM connections definied on multiple hosts, in an NDB Cluster using 3 computers listed here by host name, hosting the node types shown:

  1. '10.0.0.0': The management server

  2. '10.0.0.1': A data node and an SQL node

  3. '10.0.0.2': A data node and an SQL node

In this scenario, each data node communicates with both the management server and the other data node using TCP transporters; each SQL node uses a shared memory transporter to communicate with the data nodes that is local to it, and a TCP transporter to communicate with the remote data node. A basic configuration reflecting this setup is enabled by the config.ini file whose contents are shown here:

 [ndbd default]
 DataDir=/PATH/TO/DATADIR
 UseShm=1

 [shm default]
 ShmSize=8M
 ShmSpintime=200
 SendBufferMemory=4M

 [tcp default]
 SendBufferMemory=8M

 [ndb_mgmd]
 NodeId=49
 Hostname=10.0.0.0
 DataDir=/PATH/TO/DATADIR

 [ndbd]
 NodeId=1
 Hostname=10.0.0.1
 DataDir=/PATH/TO/DATADIR

 [ndbd]
 NodeId=2
 Hostname=10.0.0.2
 DataDir=/PATH/TO/DATADIR

 [mysqld]
 NodeId=51
 Hostname=10.0.0.1

 [mysqld]
 NodeId=52
 Hostname=10.0.0.2

 [api]
 [api]

Parameters affecting all shared memory transporters are set in the '[shm default]' section; these can be overridden on a per-connection basis in one or more '[shm]' sections. Each such section must be associated with a given SHM connection using 'NodeId1' and 'NodeId2'; the values required for these parameters are the node IDs of the two nodes connected by the transporter. You can also identify the nodes by host name using 'HostName1' and 'HostName2', but these parameters are not required.

The API nodes for which no host names are set use the TCP transporter to communicate with data nodes independent of the hosts on which they are started; the parameters and values set in the '[tcp default]' section of the configuration file apply to all TCP transporters in the cluster.

For optimum performance, you can define a spin time for the SHM transporter ('ShmSpinTime' parameter); this affects both the data node receiver thread and the poll owner (receive thread or user thread) in 'NDB'.

Restart types

Information about the restart types used by the parameter descriptions in this section is shown in the following table:

NDB Cluster restart types

Symbol Restart Type Description

N

Node The parameter can be updated using a rolling restart (see *note mysql-cluster-rolling-restart::)

S

System All cluster nodes must be shut down completely, then restarted, to effect a change in this parameter

I

Initial Data nodes must be restarted using the '--initial' option

 File: manual.info.tmp, Node: mysql-cluster-config-send-buffers, Prev: mysql-cluster-shm-definition, Up: mysql-cluster-config-file

21.4.3.16 Configuring NDB Cluster Send Buffer Parameters ........................................................

The 'NDB' kernel employs 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:

You can use the *note 'ndbinfo.transporters': mysql-cluster-ndbinfo-transporters. table to monitor send buffer memory usage, and to detect slowdown and overload conditions that can adversely affect performance.

 File: manual.info.tmp, Node: mysql-cluster-interconnects, Prev: mysql-cluster-config-file, Up: mysql-cluster-configuration

21.4.4 Using High-Speed Interconnects with NDB Cluster

Even before design of note 'NDBCLUSTER': mysql-cluster. began in 1996, it was evident that one of the major problems to be encountered in building parallel databases would be communication between the nodes in the network. For this reason, note 'NDBCLUSTER': mysql-cluster. was designed from the very beginning to permit the use of a number of different data transport mechanisms, or transporters.

NDB Cluster 7.5 and 7.6 support three of these (see *note mysql-cluster-basics::). A fourth transporter, Scalable Coherent Interface (SCI), was also supported in very old versions of 'NDB'. This required specialized hardware, software, and MySQL binaries that are no longer available.

 File: manual.info.tmp, Node: mysql-cluster-programs, Next: mysql-cluster-management, Prev: mysql-cluster-configuration, Up: mysql-cluster