MySQL Cluster on Raspberry Pi

Instructions derived from Andrew Morgan’s blog – http://www.clusterdb.com/mysql-cluster/mysql-cluster-running-on-raspberry-pi/
relevant links:
Downloading MySQL Cluster src – http://dev.mysql.com/downloads/cluster/#downloads (I used “Generic Linux (Architecture Independent), Compressed TAR Archive” – mysql-cluster-gpl-7.2.10.tar.gz)
Raspberry Pi downloads for SD card images – http://www.raspberrypi.org/downloads (I used the Soft-float Debian “wheezy” – the Oracle JVM which does not yet support the hard-float ABI )

sudo su

export http_proxy=http://proxy:8080

apt-get update
apt-get install cmake libncurses5-dev openjdk-7-jdk
get source from http://dev.mysql.com/downloads/cluster/7.3.html#downloads
cd /usr/local/src
tar xzfv /home/pi/mysql-cluster-gpl-7.3.0.tar.gz
cd mysql-cluster-gpl-7.3.0
get patch from http://bugs.mysql.com/file.php?id=17637
cd sql-common
patch -l -f –verbose -i mysql-va-list.patch client_plugin.c
cd ..
groupadd mysql
useradd -r -g mysql mysql
cmake .
make
make install

on data node
sudo su
export PATH=$PATH:/usr/local/mysql/bin
echo “export PATH=\$PATH:/usr/local/mysql/bin” >> /etc/bash.bashrc
cd /usr/local/mysql    (was /usr/local/mysqlshell)
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db –user=mysql
chown -R root .
chown -R mysql data
./bin/mysqladmin -u root password ‘raspberry’
cp support-files/my-small.cnf /etc/my.cnf
bin/mysqld_safe –user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
chmod +x /etc/init.d/mysql.server
update-rc.d mysql.server defaults

on mgmt node
sudo su
mkdir /var/lib/mysql-cluster
shell> cd /var/lib/mysql-cluster
shell> vi config.ini

config.ini

[ndb_mgmd]
hostname=130.35.70.22
NodeId=1
[ndbd default]
noofreplicas=2
DataMemory=2M
IndexMemory=1M
DiskPageBufferMemory=4M
StringMemory=5
MaxNoOfConcurrentOperations=1K
MaxNoOfConcurrentTransactions=500
SharedGlobalMemory=500K
LongMessageBuffer=512K
MaxParallelScansPerFragment=16
MaxNoOfAttributes=100
MaxNoOfTables=20
MaxNoOfOrderedIndexes=20
[ndbd]
hostname=130.35.70.18
datadir=/home/pi/mysql/ndb_data
NodeId=3
[ndbd]
hostname=130.35.70.59
datadir=/home/pi/mysql/ndb_data
NodeId=4
[ndbd]
hostname=130.35.70.99
datadir=/home/pi/mysql/ndb_data
NodeId=5
[mysqld]
NodeId=50
[mysqld]
NodeId=51
[mysqld]
NodeId=52
[mysqld]
NodeId=53
[mysqld]
NodeId=54

on each of the data/SQL nodes
vi /etc/my.cnf
[mysqld]
ndbcluster
datadir=/home/pi/mysql/ndb_data
ndb-connectstring=130.35.70.22
[mysql_cluster]
ndb-connectstring=130.35.70.22
sudo dphys-swapfile swapoff
sudo vi /etc/dphys-swapfile  =>>  CONF_SWAPSIZE=2048
sudo dphys-swapfile setup
sudo dphys-swapfile swapon

now start up the cluster
ndb_mgmd -f /var/lib/mysql-cluster/config.ini –configdir=/var/lib/mysql-cluster  –ndb-nodeid=1
(on data nodes – not sudo)
mkdir -p /home/pi/mysql/ndb_data
/usr/local/mysql/bin/ndbd

# Add puppet support
#sudo su

#export http_proxy=http://proxy:8080

apt-get install ruby

useradd –comment “Puppet” –no-create-home –system –shell /bin/false puppet
gem install puppet
mkdir /home/pi/puppet
cd /home/pi/puppet
vi base.pp
package { “vim”:
  ensure => installed,
}
sudo puppet apply base.pp

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password ‘new-password’
./bin/mysqladmin -u root -h raspberrypi password ‘new-password’
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!