Monday, 8 June 2009

MySQL Cluster - Windows/Linux Platform (Mixed setup)

In this article I would install Data nodes on mix platforms i.e. one data node on linux (Centos5) and second node on windows xp 2003.

For this setup I have used three Servers

1. 192.168.35.22 ( Solaris 10, for running Management Node)
2. 192.168.35.78 ( Data Node, Centos 5)
3. 192.168.35.74 ( Data Node, Windows XP 2003)


Steps to install Data Node onto Windows XP ( 192.168.35.74)

1) Get the latest mysql cluster binaries for windows.
http://dev.mysql.com/downloads/cluster/7.0.html#win32
2) Run Windows MSI Installer and follow the steps but don't configure/start mysql instance.
3) MSI Installer will by default install mysql binaries onto following path i.e. C:\Program Files\MySQL\MySQL Server 7.0

2) Manually create following path ( directory structure onto C: Drive)
/var/lib/mysql-cluster

3) Edit my.ini ( C:\Program Files\MySQL\MySQL Server 7.0/my.ini) and paste following contents

[mysqld]
ndbcluster
ndb-connectstring=192.168.35.22
[mysql_cluster]
ndb-connectstring=192.168.35.22

Steps to setup Data Node onto Centos 5 ( 192.168.35.78)

1) Download RPMs for Centos 5 ( I have used Red Hat Enterprise Linux 5 RPM)
http://dev.mysql.com/downloads/cluster/7.0.html#Red_Hat_Enterprise_Linux_5_RPM_(x86)

2) You should download following RPMs

  • MySQL-Cluster-gpl-client-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-devel-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-management-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-server-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-shared-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-storage-7.0.5-0.rhel5.i386.rpm
  • MySQL-Cluster-gpl-tools-7.0.5-0.rhel5.i386.rpm

3) RPM installation
rpm -Uvh MySQL-Cluster-gpl-client-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-devel-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-management-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-server-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-shared-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-storage-7.0.5-0.rhel5.i386.rpm MySQL-Cluster-gpl-tools-7.0.5-0.rhel5.i386.rpm

4. Open my.cnf file using your favorite editor e.g. vi /etc/my.cnf and paste following lines
[mysqld]
ndbcluster
ndb-connectstring=192.168.35.22
[mysql_cluster]
ndb-connectstring=192.168.35.22

Steps to install Managment Node

1) Download binaries for Solaris
http://dev.mysql.com/downloads/cluster/7.0.html#Solaris

2) uncompress the file i.e. gzip mysql-cluster-gpl-7.0.5-solaris10-i386.pkg.gz

3) install package i.e. pkgadd -d mysql-cluster-gpl-7.0.5-solaris10-i386.pkg

4) create following directory structure
/var/lib/mysql-cluster

5) setup configure.ini file for managment server and paste following contents into it
e.g.
vi /etc/configure.ini
[NDBD DEFAULT]
NoOfReplicas=2

[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
# Managment Server
[NDB_MGMD]
HostName=192.168.35.22 # the IP of Managment Server
# Storage Engines
[NDBD]
HostName=192.168.35.78 # the IP of the Windows XP running Data Node
DataDir= /var/lib/mysql-cluster
[NDBD]
HostName=192.168.35.74 # the IP of the Centos 5 running Data Node
DataDir=/var/lib/mysql-cluster
# 2 MySQL Clients
# I personally leave this blank to allow rapid changes of the mysql clients;
# you can enter the hostnames of the above two servers here. I suggest you dont.
[MYSQLD]
[MYSQLD]



Steps to start mysql cluster (192.168.35.22)


Start Management Node

1. Firstly we shall start managment server
ndb_mgmd -f /etc/configure.ini

Start Data Nodes

2. Go to Centos 5 ( 192.168.35.78) and start data node
ndbd
3. Go to Windows XP ( 192.168.35.74) and start data node
locate ndbd.exe file ( C:\Program Files\MySQL\MySQL Server 7.0\bin) and double click ndbd.exe

Check its working


You can now return to the managment server (192.168.35.22) and enter the managment console:

/opt/mysql/mysql-cluster/bin/ndb_mgm

Enter the command SHOW to see what is going on. A sample output looks like this:

-bash-3.00# ./ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.35.78 (mysql-5.1.32 ndb-7.0.5, Nodegroup: 0, Master)
id=3 @192.168.35.74 (mysql-5.1.32 ndb-7.0.5, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.35.22 (mysql-5.1.32 ndb-7.0.5)

[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from any host)
id=5 (not connected, accepting connect from any host)

If you see

not connected, accepting connect from 192.168.35.[22/78/74]

in the first or last two lines they you have a problem. Please email me with as much detail as you can give and I can try to find out where you have gone wrong and change this HOWTO to fix it

6 comments:

  1. Blogs are so informative where we get lots of information on any topic. Nice job keep it up!!
    _____________________________

    Sociology Dissertation

    ReplyDelete
  2. i couldn't find any msi packages for mysql cluster.
    any help regarding downloading msi for installation will be appreciated.

    ReplyDelete
  3. Looks like MySQL do not provide MSI packages anymore but you can see 'quick start guide for windws'
    http://downloads.mysql.com/tutorials/cluster/GetMySQLClusterRunning-Windows.pdf

    ReplyDelete
  4. Your blog is really helps for my search and i really like it.. Thanks a lot..:)

    Sociology Dissertation

    ReplyDelete
  5. I am undergoing mysql clustering for my practice and I undergone the following error

    "unable to connect with connect string: nodeid=0,localhost:1186

    Warning, event thread startup failed, degraded printouts as result, errno=115
    Connected to Management Server at: 10.112.50.56:1186
    Unable to connect with connect string: nodeid=0,10.112.50.56:1186
    Retrying every 5 seconds. Attempts left: 2 1, failed.
    Invalid command: startup
    Type HELP for help.

    id=2 (not connected, accepting connect from 10.112.50.57)"

    My config.ini

    "[ndbd default]

    NoOfReplicas=2

    Datamemory=80M

    IndexMemory=18M

    datadir=/var/lib/mysql

    [tcp default]

    [ndb_mgmd]
    portnumber=1186
    hostname=10.112.50.56 # Hostname or IP address of MGM node
    datadir=/var/lib/mysql # Directory for MGM node log files

    [ndbd]
    hostname=10.112.50.57 # Hostname or IP address
    datadir=/var/lib/mysql/ # Directory for this data node

    [ndbd]

    hostname=10.112.50.58 # Hostname or IP address
    datadir=/var/lib/mysql # Directory for this data node

    [mysqld]
    hostname=10.112.50.57 # Hostname or IP address

    [mysqld]
    hostname=10.112.50.58 # Hostname or IP address".

    ReplyDelete
  6. How did you try to start ndbd process on data/storage node? Can I see your storage/data host local config file my.ini (if its on windows platform) or my.cnf (if you have installed storage/data node on linux host)

    ReplyDelete