Contents
Installing
1.Download the RPM from MySQL.com
[syntax type=”bash”]wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.3/MySQL-Cluster-gpl-7.3.5-1.el6.x86_64.rpm-bundle.tar [/syntax]
2.Install the RPM and dependencies
[syntax type=”bash”]yum groupinstall ‘Development Tools'[/syntax]
[syntax type=”bash”]yum remove mysql-libs[/syntax]
[syntax type=”bash”]yum install libaio-devel[/syntax]
[syntax type=”bash”]rpm -Uhv MySQL-Cluster-server-gpl-7.3.5-1.el6.x86_64.rpm[/syntax]
This installs all the binaries that will be required to configure each component of the MySQL Cluster.
Configuring
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[ndbd default] NoOfReplicas=2 DataDir=/opt/mysql-cluster/data MaxNoOfAttributes=10000 MaxNoOfConcurrentOperations=150000 MaxNoOfOrderedIndexes=512 [ndb_mgmd] id=1 hostname=172.16.128.10 datadir= /opt/mysql-cluster/mgmd_data [ndbd] hostname=172.16.128.11 [ndbd] hostname=172.16.128.12 [mysqld] hostname=172.16.128.10 |
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)
1 2 |
[mysql_cluster] ndb-connectstring=172.16.128.10:1186 |
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
1 2 3 4 5 6 7 |
[mysqld] # Enable MySQL Cluster ndbcluster # Tell this node where to find its management node ndb-connectstring=172.16.128.10:1186 # Default storage engine default-storage-engine = ndbcluster |
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).
[syntax type=”html|php|js|css”]
service iptables stop
chkconfig iptables off
[/syntax]
To start MySQL Cluster the following steps must be done in order:
1.Start Management Node(s)
[syntax type=”bash”]ndb_mgmd –config-file=/opt/mysql-cluster/config.ini[/syntax]
You should see the following output in your [syntax type=”bash”]/opt/mysql-cluster/ndb_1_cluster.log.[/syntax]
Lets quickly check to ensure the cluster is up and running. Execute [syntax type=”bash”]ndb_mgm [/syntax] then [syntax type=”bash”]SHOW[/syntax] 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.
2. Start the Data Node(s)
Execute the following command on each data node. The –initial parameter should only be used for new deployments.
[syntax type=”bash”] ndbd –initial[/syntax]
You should now see an updated status from the management node shell. Indicating that the 2 data nodes(NDB) are now connected.
3.Start MySQL Node(s)
[syntax type=”bash”]service mysql start[/syntax]
Verifiy that the MySQL server has successfully joined the cluster.
4. Check NDB Engine Status
Test MySQL Cluster
In Cento’s case the binaries for the cluster specific version of MySQL Cluster was installed at [syntax type=”bash”]/usr/share/mysql/mysql.server [/syntax]
Create Database and Tables
[syntax type=”bash”]create database test_database;[/syntax]
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.
Pingback: MySQL Cluster 101 | Skillachie
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.
What is your current environment ? Is it Centos/Redhat ?
Did you complete Step 2 successfully ?
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)
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…