Skip to content

HOW TO: Install and Configure Mysql Cluster 7.2.4 on FreeBSD 9 with ZFS

March 30, 2012

1. download

db1# fetch http://mysql.linux.cz/Downloads/MySQL-Cluster-7.2/mysql-cluster-gpl-7.2.4.tar.gz

2. create datadirs (assuming zpool with name zstore already created)

db1# zfs create -o mountpoint=/db/mysql /zstore/mysql

db1# zfs create -o mountpoint=/db/mysql-cluster zstore/mysql-cluster

3. untar, move , cmake on mysql-cluster-gpl.7.2.4 and then make install

db1# tar zxf mysql-cluster-gpl-7.2.4.tar.gz

db1# mv mysql-cluster-gpl-7.2.4 /usr/local/

db1# cd /usr/local/mysql-cluster-gpl-7.2.4/

db1# cmake -DBUILD_CONFIG=mysql_release -DMYSQL_DATADIR=/db/mysql -DINSTALL_MANDIR=/usr/local/man -DINSTALL_SBINDIR=/usr/local/libexec -DINSTALL_MYSQLSHAREDIR=/usr/local/share/mysql -DINSTALL_SCRIPTDIR=/usr/local/bin -DINSTALL_LIBDIR=/usr/local/lib/mysql -DINSTALL_INCLUDEDIR=/usr/local/include/mysql -DINSTALL_BINDIR=/usr/local/bin .

db1# make install

4. CONFIGURATION scenario:

db1 -> ndb node 1, mysqld node1

db2 -> ndb node2, mysql node2, managment server

4.1 Config db2, and start managment server, ndb node2

db2# cat /usr/local/etc/config.ini | grep -v ^#|grep .

[TCP DEFAULT]
PortNumber=2202
[NDB_MGMD DEFAULT]
Datadir=/db/mysql-cluster/
[NDB_MGMD]
NodeId=1
Hostname=172.1.1.100
[NDBD DEFAULT]
NoOfReplicas=2
Datadir=/db/mysql-cluster/
DataMemory=80M
IndexMemory=18M
MemReportFrequency=30
BackupReportFrequency=10
LogLevelStartup=15
LogLevelShutdown=15
LogLevelCheckpoint=8
LogLevelNodeRestart=15
TimeBetweenWatchdogCheckInitial=60000
[NDBD]
Hostname=172.1.1.100
[NDBD]
Hostname=172.1.1.1
[MYSQLD]
[MYSQLD]

db2# cat /usr/local/etc/my.cnf|grep .

[MYSQLD]
ndbcluster
ndb-connectstring=172.1.1.100
datadir=/db/mysql
socket=/var/run/mysqld/mysql.sock
user=mysql
[MYSQLD_SAFE]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[MYSQL_CLUSTER]
ndb-connectstring=172.1.1.100

db2# /usr/local/libexec/ndb_mgmd -f /usr/local/etc/config.ini –initial  # VERY IMPORTANT OPTION: –initial (to load config from config.ini not from binary config!!!)

db2# /usr/local/libexec/ndbmtd –defaults-file=/usr/local/etc/my.cnf –initial

4.2 Config dba1 -> ndb node 1 and mysqld server

db1# grep -v ^# /usr/local/etc/my.cnf

[MYSQLD]
ndbcluster
ndb-connectstring=172.1.1.100
datadir=/db/mysql
socket=/var/run/mysqld/mysql.sock
user=mysql
[MYSQLD_SAFE]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[MYSQL_CLUSTER]
ndb-connectstring=172.1.1.100

db1# /usr/local/libexec/ndbmtd –defaults-file=/usr/local/etc/my.cnf –initial

2011-11-04 17:17:11 [ndbd] INFO — Angel connected to ‘172.1.1.100:1186’
2011-11-04 17:17:11 [ndbd] INFO — Angel allocated nodeid: 2

db1# chmod 700 /usr/local/etc/my.cnf

db1# ln -s /usr /usr/local/usr

db1# /usr/local/bin/mysql_install_db –defaults-file=/usr/local/etc/my.cnf –user=mysql –basedir=/usr/local

db1# /usr/local/bin/mysqld_safe –defaults-extra-file=/usr/local/etc/my.cnf &

4.3 Config db2 mysqld instance and start it. (mysqld on ndb node2)

db2# chmod 700 /usr/local/etc/my.cnf
db2# ln -s /usr /usr/local/usr

db2# /usr/local/bin/mysql_install_db –defaults-file=/usr/local/etc/my.cnf –user=mysql –basedir=/usr/local

db2# /usr/local/bin/mysqld_safe –defaults-extra-file=/usr/local/etc/my.cnf &

4.4 Make CHECK (show ndb manahement status: connected ndb nodes, mysqld nodes and management server):

db2# ndb_mgm -e’show’

Connected to Management Server at: localhost:1186
Cluster Configuration
———————
[ndbd(NDB)] 2 node(s)
id=2 @172.1.1.100 (mysql-5.5.19 ndb-7.2.4, Nodegroup: 0, Master)
id=3 @172.1.1.1 (mysql-5.5.19 ndb-7.2.4, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @172.1.1.100 (mysql-5.5.19 ndb-7.2.4)

[mysqld(API)] 4 node(s)
id=4 @172.1.1.1 (mysql-5.5.19 ndb-7.2.4)
id=5 (not connected, accepting connect from 172.1.1.2)
id=6 @172.1.1.100 (mysql-5.5.19 ndb-7.2.4)
id=7 (not connected, accepting connect from any host)

Advertisements

From → databases, FreeBSD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: