O'Reilly Databases

oreilly.comSafari Books Online.Conferences.

We've expanded our coverage and improved our search! Search for all things Database across O'Reilly!

Search Search Tips

advertisement
AddThis Social Bookmark Button

Print Subscribe to Databases Subscribe to Newsletters

Building a High-Availability MySQL Cluster
Pages: 1, 2, 3

Installing MySQL-HA-Cluster

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 mysqld engine.

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/):

DB-A:/var/lib/mysql # cat Ndb.cfg
host=172.16.32.1:1186

The first time you start ndbd, run it with the --initial parameter.

Running ndb_mgm now should show two active ndb nodes:

DB-A:/var/lib/mysql # ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected 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.

Pages: 1, 2, 3

Next Pagearrow




Tagged Articles

Be the first to post this article to del.icio.us

Sponsored Resources

  • Inside Lightroom

Related to this Article

Access 2013 For Dummies Access 2013 For Dummies
March 2013
$24.99 USD

PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies
by Steve Suehring
March 2013
$44.99 USD

Advertisement
Sign up today to receive special discounts,
product alerts, and news from O'Reilly.
Privacy Policy >
View Sample Newsletter >
  • Youtube
  • http://www.youtube.com/OreillyMedia
  • Twitter
  • Subscribe
  • View All RSS Feeds >
O'Reilly Media

800-889-8969 or 707-827-7019
Monday-Friday 7:30am-5pm PT
©2011, O'Reilly Media, Inc.
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
  • About O'Reilly
  • Academic Solutions
  • Contacts
  • Customer Service
  • Careers
  • Press Room
  • Privacy Policy
  • Terms of Service
  • Writing for O'Reilly
  • Community
  • Authors
  • Forums
  • Membership
  • Newsletters
  • RSS Feeds
  • User Groups
  • Partner Sites
  • makezine.com
  • makerfaire.com
  • craftzine.com
  • igniteshow.com
  • PayPal Developer Zone
  • O'Reilly Insights on Forbes.com