Initially, MySQL didn't provide the NDB build in RPM form, but they did include source RPMs so you could build your own. These days, MySQL kindly has split the different binaries into different packages: MySQL-client-4.1.12-1.i386.rpm, MySQL-devel-4.1.12-1.i386.rpm, MySQL-ndb-extra-4.1.12-1.i386.rpm, MySQL-ndb-management-4.1.12-1.i386.rpm, MySQL-ndb-storage-4.1.12-1.i386.rpm, MySQL-ndb-tools-4.1.12-1.i386.rpm, and MySQL-server-4.1.12-1.i386.rpm.
Install MySQL-ndb-management on the management node. Install MySQL-ndb-storage, MySQL-ndb-tools, MySQL-NDB-extra, and the usual MySQL-client and MySQL-server on the database nodes (here, DB-A and DB-B).
On the management node, the configuration file (config.ini) resides in the directory /var/lib/mysql/mysql-cluster:
[ndbd default] NoOfReplicas= 2 [mgm] HostName= 172.16.32.1 [ndbd] HeartbeatIntervalDbDb=600 HeartbeatIntervalDbApi=600 HostName= 172.16.32.7 DataDir: /var/lib/mysql/mysql-cluster/ DataMemory = 100M IndexMemory = 50M MaxNoOfConcurrentTransactions = 500 MaxNoOfConcurrentOperations = 250000 TimeBetweenWatchDogCheck = 40000 MaxNoOfOrderedIndexes = 27000 MaxNoOfTables = 9000 MaxNoOfAttributes = 25000 [ndbd] HeartbeatIntervalDbDb=600 HeartbeatIntervalDbApi=600 HostName = 172.16.32.107 DataDir: /var/lib/mysql/mysql-cluster/ DataMemory = 100M IndexMemory = 50M MaxNoOfConcurrentTransactions = 50 MaxNoOfConcurrentOperations = 250000 TimeBetweenWatchDogCheck = 40000 MaxNoOfOrderedIndexes = 27000 MaxNoOfTables = 9000 MaxNoOfAttributes = 25000 [mysqld] [mysqld] [mysqld]
This is the main config file that you need to get MySQL NDB cluster up and running. In this version,
ndbd has two replicas. The management server listens on 172.16.32.1. In my work project, our current needs don't exceed a 100MB data segment and a 50MB index memory.
The three unnamed
[mysqld] sections refer to the two
mysqld processes on the different DBs and a possible third
With this config in place, you can start the
ndb_mgmd for other nodes to connect to.
Configuring the NDB nodes
Both data nodes have a file called Ndb.cfg in /var/lib/mysql/mysql-cluster (also symlinked to /var/lib/mysql/):
The first time you start
ndbd, run it with the
ndb_mgm now should show two active
ndb_mgm-- NDB Cluster -- Management Client -- ndb_mgm>
showConnected to Management Server at: 172.16.32.1:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @172.16.32.7 (Version: 4.1.12, Nodegroup: 0) id=3 @172.16.32.107 (Version: 4.1.12, Nodegroup: 0, Master) [ndb_mgmd(MGM)] 1 node(s) id=1 @172.16.32.1 (Version: 4.1.12)
If you can see this, you've accomplished the first part of the mission. Congratulations! You now have a working NDB engine cluster.