5.2.1. Configurations for the MySQL Cluster Nodes

Create a file called config.ini and save it in the /etc directory (or in another suitable location) on the server where you want to host the management node(s). This file will contain all the configurations for the cluster, including configurations for the data nodes and any APIs you might want to have.

If you want to use a template for creating the config.ini file you can use the following command:

$ java -jar <path to the package> pcc_storage_mysql_cluster_7.1.x.y.mzp create

This will generate a config.ini file, containing a default configuration, and update it according to the information below.

Note!

A new sub directory called database with another sub directory called mysqlcluster will be created in the directory you are located in when executing the command, where the config.ini file template will be placed. Remember to place this file in the correct directory from where you want to host the management node(s).

Configurations for Management Nodes

These settings will apply for all management nodes.

[NDB_MGMD DEFAULT] 
portnumber=1186 
datadir=/data/mysqlcluster

These settings will apply for one specific node and a separate [NDB_MGMD] section has to be added for each management node in the cluster.

[NDB_MGMD] 
nodeid=1 
hostname=10.46.20.121 
portnumber=1186 
datadir=/data/mysqlcluster
  • The nodeid has to be a unique number for the node within the cluster.
  • It is recommended to use the IP address for the hostname in order to avoid DNS lookups.
  • If no port is assigned, 1186 will be used by default.
  • The directory specified for datadir is the directory used for log files.

Configurations for Data Nodes

These settings will apply for all data nodes.

[NDBD DEFAULT] 
datadir=/data/mysqlcluster 
NoOfReplicas=2 
DataMemory=2048M 
IndexMemory=100M
MaxNoOfConcurrentOperations=32768
MaxNoOfConcurrentTransactions=1024
NoOfFragmentLogFiles=12 
FragmentLogFileSize=256M 
DiskCheckpointSpeed=10M
  • The datadir is the directory where data files and local checkpoints will be stored.
  • The number of replicas is the number of copies you want to have of the database. If you have two data nodes and 2 replicas, then all data will be stored in both data nodes, where half the data will be managed by one node, and the other half will be managed by the other. If you have four data nodes, at least two of the data nodes (depending on which nodes contain which data) up and running in order to have all data in the database available.
  • The DataMemory is the amount of data memory configured per data node. If you have two data nodes with two replicas, the entire database will be stored in each node and this parameter should be set to the total amount of data memory needed. See 5.2.6. Dimensioning of the Database for information on how much data memory you will need.
  • The IndexMemory is depending on the number of tables and the number of unique hash indexes, and is usually configured to be 1/6 or 1/5 of the data memory. However, you can also use a formula, described in Section 6.3.6, Dimensioning of the database, to calculate the amount of index memory you will need.
  • MaxNoOfConcurrentOperations specifies how many operations the data node should be able to handle concurrently at any point in time. Each operation will require 1KB of RAM. The number of operations depend on the transactions and sql statements. One transaction can contain several operations.
  • MaxNoOfConcurrentTransactions specifies how many transactions the data node should be able to handle concurrently. Each thread in can run one transaction at the time.

Disk side - redo log parameters

These parameters are important for being able to make a full recovery, and has to be configured correctly in order for the database to work. If the redo log is not large enough, i e if it becomes full before a local checkpoint is completed, it will crash.

[NDBD] 
nodeid=3 
hostname=10.46.20.121
[NDBD] 
nodeid=4 
hostname=10.46.20.122
[NDBD] 
nodeid=5 
hostname=10.46.20.123 
nodegroup=65536
[NDBD] 
nodeid=6 
hostname=10.46.20.124 
nodegroup=65536

  • NoOfFragmentLogFiles specifies how many log files you want to have. The minimum number of fragment logs is 3.
  • FragmentLogFileSize specifies the amount of disk space configured for each fragment log.
  • DiskCheckpointSpeed specifies how fast the data node should perform the checkpoint, i e the maximum number of megabytes per second written to disk during local checkpoint.
  • See 5.2.6. Dimensioning of the Database for information about how to calculate the NoOfFragmentLogFiles and FragmentLogFileSize and how to dimension the redo log.

These settings will apply for one specific node and a separate [NDBD] section has to be added for each data node in the cluster.

[API] 
nodeid=9 
hostname=127.0.0.1
[API]
[API
[API] 
...
  • The nodeid has to be a unique number for the node within the cluster.
  • It is recommended to use the IP address for the hostname in order to avoid DNS lookups.
  • If you want to prepare for the future addition of more data nodes, add the parameter nodegroup configured to 65536, to indicate that this will be added in the future. The first two datanodes will be given node group 0 and 1. 
  • One section of [API] creates on connection slot so add several of these.
  • The nodeid specifies the node ID for the API. This parameter is optional.
  • The hostname specifies which host that will be allowed to connect on this API. This parameter is optional.

Example of config.ini file

Example - config.ini

[NDB_MGMD DEFAULT] 
 portnumber=1186 
datadir=/data/mysqlcluster
[NDB_MGMD] 
nodeid=1 
hostname=10.46.20.121 
portnumber=1186 
datadir=/data/mysqlcluster
[NDBD DEFAULT] 
datadir=/data/mysqlcluster 
NoOfReplicas=2 
DataMemory=128M 
IndexMemory=32M
MaxNoOfConcurrentOperations=32768 
MaxNoOfConcurrentTransactions=1024 
NoOfFragmentLogFiles=3 
FragmentLogFileSize=16M 
DiskCheckpointSpeed=10M
[NDBD] 
nodeid=3 
hostname=10.46.20.121
[NDBD] 
nodeid=4 
hostname=10.46.20.122
[API]
[API]
[API]
[API]
[API]
[API]
[API]
[API]
[API]
[API]