Detailed Description of Cluster Management using Generated Scripts

A set of scripts are generated when you installed MySQL Cluster to manage the cluster.

These scripts are found in the directory:

$NDB_HOME/scripts

The scripts allow you to start/shutdown both a cluster or a process in a cluster, where processes include management servers, data nodes and MySQL Servers.

MySQL Cluster Processes

The following processes are started by the cluster initialisation and normal startup scripts:

  • ndb_mgmd - the management server process
  • ndbd - the data node processes (each ndbd process also has an angel process)
  • mysqld - the MySQL server processes

To make sure the relevant process is running on the relevant host, run:

ps -ef | grep ndb

Output Directories

The following directories are created in (for a localhost user-level installation ~/.mysql or /var/lib/mysql-cluster/ for a distributed, root-user installation):

  • mysql[-version] : this directory contains the MySQL Server and NDB binaries (stored in /usr/local/mysql[-version] for root-user installations)
  • mysql : is optionally created as a symbolic link to the currently used version
  • logs : this directory contains the log files written by the ndb_mgmd, ndbd and mysqld processes. 'cluster.log' is the main log file; it is written by the ndb_mgmd process.
  • ndb[-version] : this directory contains the NDB data directories for the nodes in the cluster, and the MySQL Server data directories.
  • ndb : is created as a symbolic link to the currently used version
    • scripts : this directory contains the scripts used to startup/shutdown the cluster and its processes.
  • [backups] : is created when you call the copy-backup.sh script after having successfully called start-backup.sh

Cluster Internals

* See the MySQl Cluster Manual Chapter on Ndb Internals

Directory Layout

The base directories that are installed:

Within the ndb directory, the scripts directory stores the scripts used to manage the cluster, the data nodes' data directories are stored in ndb_data, the mysql servers' data directories are stored in mysql_[N], and mgmd1 is the management server processes' directory.

Requirements: Complete installation of MySQL Cluster using ndbinstaller.sh

First Step: Initializing the Cluster (warning: this destroys everything in the database)

If you didn't initialize and start the cluster during installation, you must perform this step first.

To make sure the MySQL Servers have started, after this step completes, run "Viewing the State of the Cluster":

Viewing the State of the Cluster

You can use view the state of the cluster using:

./mgm-client.sh -e show

Note: mysql servers in the initialisation and startup scripts are started after the state of the cluster is printed out (so it looks as if they haven't started).

Shutting Down the Cluster

./shutdown-cluster.sh 

You can skip the stopping of mysqlds by passing the "-s" switch.

Normal Start of the Cluster

This script is used to start the cluster, after it has been initialised and run for the first time:

./start-noinit-2node.sh 

Note, that (again), it appears that the MySQL Server hasn't started - however, the MySQL server was started just after the state of the cluster was printed out. View the state of the cluster after starting it to make sure the MySQL Server has started.

Rolling Restart of Cluster

If we change the configuration of the cluster or if we want to defragment its memory, we perform a rolling restart.

The cluster is still available while the rolling restart is being performed. The nodes are restarted in the order: Management server, then all the data nodes. MySQL Servers are not restarted.

Checking Logs for Problems

Check the logs, if you have problems. The main log generated by the management server is 'cluster.log'. It contains a written log of events in the cluster.

Attachments