MySQL 5.1 NDB Cluster on EC2 configuration files

As I mentioned in the MySQL 5.1 NDB Cluster testing article I was going to provide the configuration files I used for setting up the cluster.

There are three main files for setting up a MySQL cluster

  1. configure.ini : The MySQL cluster management configuration file.
  2. /etc/my.cnf: Standard MySQL configuration file, required for data and SQL/API nodes.
  3. /etc/hosts: Local names resolution file required on all cluster nodes.

Specifically for EC2. I use names rather ip addresses and use /etc/hosts to locally resolve those names to specific ip addresses. This means you will have to change the ip addresses to be correct before you launch the cluster.
To get the local ip address you can use a command: nslookup `hostname`

These configuration files will enable you to have 2 management nodes on the hosts:

  1. mysql-ndb_mgmd1
  2. mysql-ndb_mgmd2

Two data nodes on the hosts:

  1. mysql-ndbd1
  2. mysql-ndbd2

And eight MySQL nodes on any host, this is dangerous, so launch the cluster behind a firewall or on EC2 in a specific security group.

Have Fun

Paul

Here are my configuration files.

1. The configure.ini file, required on all management nodes.


[ndbd default]
NoOfReplicas= 2
MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= 128
DataMemory= 256M
IndexMemory= 256M
Diskless= false
TimeBetweenWatchDogCheck= 30000
DataDir= /mnt/mysql-cluster/data
MaxNoOfOrderedIndexes= 500
MaxNoOfAttributes= 1000
TimeBetweenGlobalCheckpoints= 500
NoOfFragmentLogFiles= 4
FragmentLogFileSize=12M
DiskPageBufferMemory= 64M
ODirect= 1
# the following parametes just function as a small regression
# test that the parameter exists
InitialNoOfOpenFiles= 27

#
# Increase timeouts to cater for slow test-machines
# (possibly running several tests in parallell)
#
HeartbeatIntervalDbDb= 30000
HeartbeatIntervalDbApi= 30000
#TransactionDeadlockDetectionTimeout= 7500

[ndbd]
HostName= mysql-ndbd1 # hostname is a valid network address

[ndbd]
HostName= mysql-ndbd2 # hostname is a valid network address

[ndb_mgmd]
HostName= mysql-ndb_mgmd1 # hostname is a valid network adress
DataDir= /mnt/mysql-cluster/mgmd-data #
#PortNumber= CHOOSE_PORT_MGM

[ndb_mgmd]
HostName= mysql-ndb_mgmd2 # hostname is a valid network adress
DataDir= /mnt/mysql-cluster/mgmd-data #
#PortNumber= CHOOSE_PORT_MGM

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

[mysqld]

2. The /etc/my.cnf required on all data and SQL/API nodes.


# Options for mysqld process:
[MYSQLD]
ndbcluster # run NDB storage engine
ndb-connectstring=mysql-ndb_mgmd1,mysql-ndb_mgmd2 # location of management server

# Options for ndbd process:
[MYSQL_CLUSTER]
ndb-connectstring=mysql-ndb_mgmd1,mysql-ndb_mgmd2 # location of management server

3. The /etc/hosts file required on all hosts


# Mysql Cluster data node
10.255.14.177 mysql-ndbd1
10.255.31.160 mysql-ndbd2
# Mysql Cluster mgm node
10.255.14.177 mysql-ndb_mgmd1
10.255.31.160 mysql-ndb_mgmd2
# extra
127.0.0.1 localhost
Advertisements