Here is a short list of things you should check before you attempt to install or use MySQL Cluster for a project (if you are just setting up a test database as a proof of concept, you can skip this part):
[root@host] free -m total used free shared buffers cached Mem: 3956 3471 484 0 199 2638 -/+ buffers/cache: 633 3322 Swap: 2047 22 2024
This server has 2638MB + 484MB free, which is just over 3GB.
Obtaining and Installing MySQL Cluster
Before you install MySQL Cluster, you should clearly understand the different processes that you have to undertake to set up the three different type of nodes:
MySQL-Max is needed on all nodes. As described shortly, you should install MySQL-Max on all the nodes that you plan to take part in the cluster before you do anything else.
Designing a Cluster
It is important that you give some thought to the number of physical servers your cluster will require. Shortly, you will see the sample cluster that we use through this book. It is as simple as you can get if you want a highly available setup, and it requires three physical machines.
You will learn later in this chapter how to calculate the RAM usage for your cluster, but this section explains the important decisions you need to make regarding the layout of your new cluster.
First, you have to decide how many copies of each piece of data you would like the cluster to hold. This determines the number of nodes that will be in each node group. (A node group is a group of storage nodes that hold the same data.)
Second, you need to decide how many storage nodes should be part of your cluster. This depends on two things:
The number of replicas determines the total memory usage required; however, you can spread this out over any number of nodes (and therefore servers) from 1 to 62 to keep the amount of memory required per server to an acceptable level. Note that 64 nodes is the maximum total of all nodesincluding SQL, management, and storage nodesso the realistic maximum number of storage nodes is 62 to allow for 1 management and 1 SQL node.
At this stage, you can estimate your total memory usage based on your current database size (which you can easily determine) if you use the following formula:
Total size of database in NDB format x Number of replicas x 1.1
You then divide this figure by the number of nodes to estimate the memory requirement per node. For initial rough calculations, you can treat the size of the database in NDB as being equal to the current size in whatever storage engine the database is held, subject to the caveat that if you use variable-width columns, you should covert your variable-width columns to fixed-width and calculate the new size and then plug the new size in to the preceding formula to get a more accurate estimate. Of course, you can just make a guestimate or use the ndb_size.pl script that is discussed shortly.
Later in this chapter, you will learn how to calculate your memory usage far more accurately. The purpose of mentioning this basic formula here is to give you some idea of how much RAM you are likely to need. Bear in mind that this estimate could be off by a long way in some circumstances; many new users are surprised by the amount of RAM that a MySQL cluster can and does consume!
Installing MySQL Max
Backup and Recovery
Security and Management
A MySQL Cluster Binaries
B Management Commands
C Glossary of Cluster Terminology