MySQL Cluster Getting Started [Redhat/Centos 6]

Installing

1.Download the RPM from MySQL.com

wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.3/MySQL-Cluster-gpl-7.3.5-1.el6.x86_64.rpm-bundle.tar 

2.Install the RPM  and dependencies

yum groupinstall 'Development Tools'

yum remove mysql-libs

yum install libaio-devel

rpm -Uhv MySQL-Cluster-server-gpl-7.3.5-1.el6.x86_64.rpm

This installs all the binaries that will be required to configure each component of the MySQL Cluster.

Screen Shot 2014-06-18 at 9.55.52 PM

 

Configuring

These are the minimal settings to get started with MySQL Cluster. Consider running other parameters

Management Node(s) [ndb_mgmd]

MySQL cluster has a configuration file config.ini which should reside on all management nodes.  The configuration file is made up of three(3) main sections:

  • [ndbd default] – Section for parameters that are shared between each node
  • [ndb_mgmd] –  Section for parameters for management node/daemon
  • [ndbd] – Section for parameters related to the storage/data node
  • [mysqld] –  Section for parameters related the mysql node

 

Data/Storage Node(s)[ndbd]

Ensure that the ndbd is installed on your server . You can compile and install this separately or you can repeat steps 1 & 2 under Installing.  Configure /etc/my.cnf with the information below. This allows the storage nodes to find  their management node(s)

 

MySQL Server Node(s)[mysqld]

1.  Configure /etc/my.cnf to connect to the NDB cluster. Installed seem to be here /usr/my.cnf but  MySQL server will search /etc/my.cnf first

 

Running

Ensure that Iptables is disabled or the the correct rules have been put in place to allow connections on port 1186 . You might want to restrict this to only the data nodes that should be talking to your management node(s).


service iptables stop

chkconfig iptables off

To start MySQL Cluster the following steps must be done in order:

1.Start Management Node(s)

ndb_mgmd --config-file=/opt/mysql-cluster/config.ini

You should see the following output in your

/opt/mysql-cluster/ndb_1_cluster.log.

mysql cluster logs

 

Lets quickly check to ensure the cluster is up and running. Execute 

ndb_mgm 

then

SHOW

at the prompt  to get a quick overview of the status of the cluster. As you can see below we have two data nodes(NDB), 1 SQL node(mysqld) and 1 management node(MGM). Only the management node is currently running.

Cluster Shell

2. Start the Data Node(s)

Execute the following command on each data node. The –initial parameter should only be used for new deployments.

 ndbd --initial

Screen Shot 2014-06-19 at 11.47.04 PM

You should now see an updated status from the management node shell. Indicating that the 2 data nodes(NDB) are now connected.

Screen Shot 2014-06-20 at 12.24.00 AM

 

3.Start MySQL Node(s)

service mysql start

Verifiy that the MySQL server has successfully joined the cluster.

4. Check NDB Engine  Status

Screen Shot 2014-06-29 at 9.48.47 PM

Test MySQL Cluster

Ensure that you do not have multiple installations of  MySQl server installed. Ensure that  it is the cluster edition of MySQL server that gets started and not another version that might have been installed by default.

In Cento’s case the binaries for the cluster specific version of MySQL Cluster was installed at 

/usr/share/mysql/mysql.server 

Create Database and Tables

create database test_database;

MySQL CLuster

 

 

 

 

 

 

 

 

 

MySQL Cluster

 

 

 

 

 

 

 

 

Create test table and data and then check to ensure that  the database  and data inserted in the table is accessible from other MySQL nodes that are apart of the cluster.

 

5 comments

  1. Pingback: MySQL Cluster 101 | Skillachie

  2. norman   •  

    hi, i tried to follow this tuto step by ste, but a really cannot understand how you jumped from the end of step 2 to step 3

    the only response i’ve got from service mysql start is : Starting MySQL…… ERROR! The server quit without updating PID file (…)

    and when a do it on manager, the mysql command is not found.

    can you detail this part of you processus ?

    thanks a lot.

    • Dwayne V Campbell   •     Author

      What is your current environment ? Is it Centos/Redhat ?

      Did you complete Step 2 successfully ?

  3. Driggs   •  

    I’m having trouble on my.cnf on my data nodes. I can only start the mysql using “/etc/init.d/mysql.server start” when my.cnf is removed on the ‘/etc/’ folder.

    And the error I got when I start the mysql.server when there’s my.cnf is: “The server quit without updating PID file (/usr/local/mysql/data/dtnode1.pid)

    This is the content of my.cnf:
    [mysqld]
    ndbcluster
    ndb-connectstring=10.88.41.50 (IP of the management node)
    datadir=/usr/local/mysql/data
    default-storage-engine=ndbcluster

    [mysql_cluster]
    ndb-connectstring=10.88.41.50 (IP of the management node)

    • Dwayne V Campbell   •     Author

      Sorry about my delayed reply. I did not get the notification of a pending comment in my email. Can you share the output of the log /var/log/mysql…

Leave a Reply

Your email address will not be published. Required fields are marked *