MySQl Cluster 7.2 — a single node cluster

Today we will get MySQL Cluster running on a single node.

A few years ago I created as presentation on running MySQL Cluster 5.1 on a laptop using Virtualbox that has proven to be the most popular download from with over nine hundred downloads.  Now MySQL 7.2 is in development milestone release and I find that I have some catching up to do.

Those of you with access to the Carrier Grade Edition (CGE) of Cluster, check out MySQL Cluster Manager 1.1 and Andrew Morgan’s  blog.  You can set up a cluster with minimal editing of configuration files or perform online software upgrades.

But MySQL Cluster 7.2 from is not CGE.  I started reading other introductory writing on cluster and discovered the Cluster Quickstart Guides.  This guide details what need to be done got get cluster running on a single node. But the guide needs just a little tweaking to make it work with Cluster 7.2.2. Please note that my earlier document and this guide are to allow you to familiarize yourself with MySQL cluster but you will need multiple nodes and supporting network to get the high performance, highly available five nine’s performance cluster can provide.

The first step is downloading MySQL Cluster 7.2 from Labs.MySQl.Com.

Next un-tar the software under your home directory.  I created a directory named cluster and then set up a symbolic linked named mysql to point to the software.  I then created ~/cluster/data, ~/cluster/conf, and ~/cluster/ndb_data.

This step is the configuration files and placing them under ~/cluster/conf. First the my.cnf file:


Next the config.ini file:


[ndbd default]




If you are following along with the Quickstart Guide, note that id has been depreciated and nodeid is used.

The forth step is installing the MySQl software from the ~/cluster/mysql directory. ./scripts/scripts/mysql_install_db –no-defaults –datadir=~/cluster/data

Now we can start the cluster manager, /bin/ndb_mgmd -f ~/cluster/conf/config.ini –initial –configdir=~/cluster/conf/.

Then two data node daemons are started. And you will need to give them a little time to get fully functional. So enter ./bin/ndbd followed by ./bin/ndbd.

You can check the status of the cluster by using ./bin/ndb_mgm -e show and you show see something similar to:

Connected to Management Server at: localhost:1186
Cluster Configuration
[ndbd(NDB)] 2 node(s)
id=3 @ (mysql-5.5.15 ndb-7.2.2, Nodegroup: 0, Master)
id=4 @ (mysql-5.5.15 ndb-7.2.2, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @ (mysql-5.5.15 ndb-7.2.2)

[mysqld(API)] 1 node(s)
id=50 (not connected, accepting connect from any host)

So we see our nodegroup of two data servers, our management server node and unoccupied slot for the SQL node.

Now we can test by creating a NDB table and adding the data.

dstokes@UBox:~/cluster/mysql$ ./bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.15-ndb-7.2.2-gpl MySQL Cluster Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \s
./bin/mysql Ver 14.14 Distrib 5.5.15-ndb-7.2.2, for linux2.6 (i686) using readline 5.1

Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.15-ndb-7.2.2-gpl MySQL Cluster Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 4 min 4 sec

Threads: 1 Questions: 4 Slow queries: 0 Opens: 33 Flush tables: 2 Open tables: 0 Queries per second avg: 0.016

mysql> create database testcluster; use testcluster;
Query OK, 1 row affected (0.31 sec)

Database changed
mysql> create table t1 (id int unsigned not null primary key, name char(20)) engine=ndb;

Query OK, 0 rows affected (1.21 sec)

mysql> show crate teate table t1;
| Table | Create Table |
| t1 | CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`name` char(20) DEFAULT NULL,
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
1 row in set (0.03 sec)

mysql> insert into t1 values (1,'Adam'),(2,'Bob'),(3,'Charles'),(4,'Dave'),(5,'Edward'),(6,'Fred');
Query OK, 6 rows affected (0.27 sec)
Records: 6 Duplicates: 0 Warnings: 0

mysql> select * from t1;
| id | name |
| 5 | Edward |
| 1 | Adam |
| 2 | Bob |
| 4 | Dave |
| 3 | Charles |
| 6 | Fred |
6 rows in set (0.24 sec)


Be sure to check out the files under ndb_data for extra credit.

Published by


Dave Stokes is a MySQL Community Manager for Oracle and previously was the MySQL Certification Manager for MySQL AB and Sun Microsystems. He has a MBA from the University Of San Diego.

2 thoughts on “MySQl Cluster 7.2 — a single node cluster”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s