2 x Data Nodes - data01, data02
2 x MySQL Nodes - mysql01, mysql02
1 x Management Node - mgm
Data Nodes
[cc lang='bash']
\$ apt-get install libaio1 -y
\$ wget
http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.3/mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
-O mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb
\$ dpkg -i mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb
\$ ln -s /opt/mysql/server-5.6/ /usr/local/mysql
\$ export PATH=\$PATH:/usr/local/mysql/bin
\$ echo "export PATH=\\$PATH:/usr/local/mysql/bin" >>
/etc/bash.bashrc
\$ groupadd mysql
\$ useradd -g mysql mysql
\$ cd /usr/local/mysql
\$ ./scripts/mysql_install_db --user=mysql
\$ chown -R root .
\$ chown -R mysql data
\$ chgrp -R mysql .
\$ cat \<
[mysqld]
ndbcluster # run NDB storage engine
[mysql_cluster]
ndb-connectstring=mgm # location of management server
EOF
\$ echo "/usr/local/mysql/bin/ndbd" >> /etc/rc.local
# copy ndb_mgm binaries to management server
\$ scp /usr/local/mysql/bin/ndb_mgm* root@mgm:/usr/local/bin/
[/cc]
MySQL Nodes
[cc lang='bash']
\$ apt-get install libaio1 -y
\$ wget
http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.3/mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
-O mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb
\$ dpkg -i mysql-cluster-gpl-7.3.2-debian6.0-x86_64.deb
\$ ln -s /opt/mysql/server-5.6/ /usr/local/mysql
\$ export PATH=\$PATH:/usr/local/mysql/bin
\$ echo "export PATH=\\$PATH:/usr/local/mysql/bin" >>
/etc/bash.bashrc
\$ groupadd mysql
\$ useradd -g mysql mysql
\$ cd /usr/local/mysql
\$ ./scripts/mysql_install_db --user=mysql
\$ chown -R root .
\$ chown -R mysql data
\$ chgrp -R mysql .
\$ cat \<
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
ndbcluster # run NDB storage engine
ndb-connectstring=mgm # location of management server
[mysql_cluster]
ndb-connectstring=mgm # location of management server
EOF
\$ cp support-files/mysql.server /etc/init.d/mysql
\$ chmod +x /etc/init.d/mysql
\$ update-rc.d mysql defaults
[/cc]
Management Node
[cc lang='bash']
\$ ls /usr/local/bin/ndb_mgm*
\$ mkdir /var/lib/mysql-cluster
\$ cat \<
[tcp default]
[ndbd default]
NoOfReplicas=1
DataMemory=80M # Default
IndexMemory=18M # Default
[ndb_mgmd]
NodeId=255 # Max Id
hostname=mgm
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
[ndbd]
NodeId=1
hostname=data01
datadir=/usr/local/mysql/data # Directory for this data node's data
files
[ndbd]
NodeId=2
hostname=data02
datadir=/usr/local/mysql/data # Directory for this data node's data
files
[mysqld]
NodeId=101
hostname=mysql01
[mysqld]
NodeId=102
hostname=mysql02
EOF
# start management node
\$ ndb_mgmd --initial -f /var/lib/mysql-cluster/config.ini
--configdir=/var/lib/mysql-cluster/
\$ ndb_mgm -e "show"
[/cc]
Data Nodes
[cc lang='bash']
# start data nodes
\$ ndbd --initial
[/cc]
MySQL Nodes
[cc lang='bash']
# start mysql nodes
\$ /etc/init.d/mysql start
\$ mysql_secure_installation
[/cc]
http://dev.mysql.com/doc/refman/5.6/en/mysql-cluster.html
mysql-cluster-technical-whitepaper