Spec-Zone .ru
спецификации, руководства, описания, API

17.2.4. Initial Configuration of MySQL Cluster

In this section, we discuss manual configuration of an installed MySQL Cluster by creating and editing configuration files.

MySQL Cluster NDB 7.3 also provides a GUI installer which can be used to perform the configuration without the need to edit text files in a separate application. For more information, see Section 17.2.1, "The MySQL Cluster Auto-Installer".

For our four-node, four-host MySQL Cluster (see Cluster nodes and host computers), it is necessary to write four configuration files, one per node host.

Configuring the data nodes and SQL nodes. The my.cnf file needed for the data nodes is fairly simple. The configuration file should be located in the /etc directory and can be edited using any text editor. (Create the file if it does not exist.) For example:

shell> vi /etc/my.cnf
Note

We show vi being used here to create the file, but any text editor should work just as well.

For each data node and SQL node in our example setup, my.cnf should look like this:

[mysqld]# Options for mysqld process:ndbcluster                      # run NDB storage engine[mysql_cluster]# Options for MySQL Cluster processes:ndb-connectstring=192.168.0.10  # location of management server

After entering the preceding information, save this file and exit the text editor. Do this for the machines hosting data node "A", data node "B", and the SQL node.

Important

Once you have started a mysqld process with the ndbcluster and ndb-connectstring parameters in the [mysqld] and [mysql_cluster] sections of 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.

Configuring the management node. The first step in configuring the management node is to create the directory in which the configuration file can be found and then to create the file itself. For example (running as root):

shell> mkdir /var/lib/mysql-clustershell> cd /var/lib/mysql-clustershell> vi
        config.ini

For our representative setup, the config.ini file should read as follows:

[ndbd default]# Options affecting ndbd processes on all data nodes:NoOfReplicas=2    # Number of replicasDataMemory=80M    # How much memory to allocate for data storageIndexMemory=18M   # How much memory to allocate for index storage                  # For DataMemory and IndexMemory, we have used the                  # default values. Since the "world" database takes up                  # only about 500KB, this should be more than enough for                  # this example Cluster setup.[tcp default]# TCP/IP options:portnumber=2202   # This the default; however, you can use any                  # port that is free for all the hosts in the cluster                  # Note: It is recommended that you do not specify the port                  # number at all and simply allow the default value to be used                  # instead[ndb_mgmd]# Management process options:hostname=192.168.0.10           # Hostname or IP address of MGM nodedatadir=/var/lib/mysql-cluster  # Directory for MGM node log files[ndbd]# Options for data node "A":                                # (one [ndbd] section per data node)hostname=192.168.0.30           # Hostname or IP addressdatadir=/usr/local/mysql/data   # Directory for this data node's data files[ndbd]# Options for data node "B":hostname=192.168.0.40           # Hostname or IP addressdatadir=/usr/local/mysql/data   # Directory for this data node's data files[mysqld]# SQL node options:hostname=192.168.0.20           # Hostname or IP address                                # (additional mysqld connections can be                                # specified for this node for various# purposes such as running ndb_restore)
Note

The world database can be downloaded from http://dev.mysql.com/doc/, where it can be found listed under "Examples".

After all the configuration files have been created and these minimal options have been specified, you are ready to proceed with starting the cluster and verifying that all processes are running. We discuss how this is done in Section 17.2.5, "Initial Startup of MySQL Cluster".

For more detailed information about the available MySQL Cluster configuration parameters and their uses, see Section 17.3.2, "MySQL Cluster Configuration Files", and Section 17.3, "Configuration of MySQL Cluster NDB 7.3". For configuration of MySQL Cluster as relates to making backups, see Section 17.5.3.3, "Configuration for MySQL Cluster Backups".

Note

The default port for Cluster management nodes is 1186; the default port for data nodes is 2202. However, the cluster can automatically allocate ports for data nodes from those that are already free.