4.2 MySQL Cluster Configuration

If you want to change the configurations for MySQL Cluster, we recommend that you do it off peak. Even though it is generally safe to increase and decrease parameters, but decreasing a parameter such as DataMemory may have the effect that the memory will not be able to store all data.


Updating MySQL Cluster Configurations Without Downtime

If you need to update the cluster by, for example, adding new data nodes or changing other configuration you can perform a so called rolling restart to do this without data loss.

To perform a rolling restart:

  1. Update the config.ini file, for example to include the new node, or with any other changes you might want to make.

  2. Restart the management nodes by first shutting them down with the following commands:

    $ ps -ef | grep ndb_mgmd
    $ kill -15 <pid>

    and then starting them up again with the following command:

    ndb_mgmd -f /etc/config.ini --configdir=/etc/ --reload

    Restart each data node by first shutting them down with the following commands:

    $ ps -ef | grep ndbmtd
    kill -15 <pid>

    Note

    There will be two processes on each data node, and the one that has the other as its parent pid, the process with the highest process id, should be killed.

    and then starting them up again with the following command:

    $ ndbmtd --ndb-connectstring=<IP address of the data node>:1186 --ndb-nodeid=<node id>

    Note

    In order to keep traffic running, make sure to kill only one data node at the time, start it up, and wait for the message "Node started" to appear in the logs before restarting the next data node.

  3. If any new nodes have been added, start these when all existing data nodes have been restarted with the following command:

    $ ndbmtd --ndb-connectstring=<IP address of the data node>:1186 --ndb-nodeid=<node id> --initial
  4. Restart the MySQL server with the following command:

    $ mysqld --defaults-file=/etc/my.cnf &
  5. If any new nodes have been added, reorganize the partitions to take the new data nodes into account by using the following command:

    $ mysql -uroot -ppassword -h <IP address of the MySQL server>

    and altering the table TABLE_NAME REORGANIZE PARTITION.

    Note

    Since this will take a while and will have impact on the performance, it is recommended to perform this procedure at low traffic during a maintenance window.

If a data node seems corrupt even though the other data nodes are running, you can recreate the corrupt node by killing the old process and restoring the data node with the following command:

$ ndbmtd --ndb-connectstring=<IP address of the data node>:1186 --ndb-nodeid=<node id> --initial

This will mean that the data node starts as a new node and will replicate all the existing data from the other data nodes without data loss.

Note!

Ensure that you DO NOT shut down any other nodes since all nodes must start successfully on a restart for the start to be successful.