The performance of an NDB Cluster that uses Disk Data storage
can be greatly improved by separating data node file systems
from undo log files and tablespace data files and placing these
on different disks. In early versions of NDB Cluster, there was
no direct support for this in NDB Cluster, but it was possible
to achieve this separation using symbolic links as described in
this section. NDB Cluster 7.2 supports the data node
configuration parameters
FileSystemPathDD,
FileSystemPathDataFiles,
and
FileSystemPathUndoFiles,
which make the use of symbolic links for this purpose
unnecessary. For more information about these parameters, see
Disk Data file system parameters.
Each data node in the cluster creates a file system in the
directory named
ndb_
under the data node's
node_id_fsDataDir as defined in
the config.ini file. In this example, we
assume that each data node host has 3 disks, aliased as
/data0, /data1, and
/data2, and that the cluster's
config.ini includes the following:
[ndbd default] DataDir= /data0
Our objective is to place all Disk Data log files in
/data1, and all Disk Data data files in
/data2, on each data node host.
In this example, we assume that the cluster's data node hosts are all using Linux operating systems. For other platforms, you may need to substitute you operating system's commands for those shown here.
To accomplish this, perform the following steps:
Under the data node file system create symbolic links pointing to the other drives:
shell>cd /data0/ndb_2_fsshell>lsD1 D10 D11 D2 D8 D9 LCP shell>ln -s /data0 dnlogsshell>ln -s /data1 dndata
You should now have two symbolic links:
shell> ls -l --hide=D*
lrwxrwxrwx 1 user group 30 2007-03-19 13:58 dndata -> /data1
lrwxrwxrwx 1 user group 30 2007-03-19 13:59 dnlogs -> /data2
We show this only for the data node with node ID 2; however, you must do this for each data node.
Now, in the mysql client, create a log file group and tablespace using the symbolic links, as shown here:
mysql>CREATE LOGFILE GROUP lg1->ADD UNDOFILE 'dnlogs/undo1.log'->INITIAL_SIZE 150M->UNDO_BUFFER_SIZE = 1M->ENGINE=NDBCLUSTER;mysql>CREATE TABLESPACE ts1->ADD DATAFILE 'dndata/data1.log'->USE LOGFILE GROUP lg1->INITIAL_SIZE 1G->ENGINE=NDBCLUSTER;
Verify that the files were created and placed correctly as shown here:
shell>cd /data1shell>ls -ltotal 2099304 -rw-rw-r-- 1 user group 157286400 2007-03-19 14:02 undo1.dat shell>cd /data2shell>ls -ltotal 2099304 -rw-rw-r-- 1 user group 1073741824 2007-03-19 14:02 data1.dat
If you are running multiple data nodes on one host, you must
take care to avoid having them try to use the same space for
Disk Data files. You can make this easier by creating a
symbolic link in each data node file system. Suppose you are
using /data0 for both data node file
systems, but you wish to have the Disk Data files for both
nodes on /data1. In this case, you can
do something similar to what is shown here:
shell>cd /data0shell>ln -s /data1/dn2 ndb_2_fs/ddshell>ln -s /data1/dn3 ndb_3_fs/ddshell>ls -l --hide=D* ndb_2_fslrwxrwxrwx 1 user group 30 2007-03-19 14:22 dd -> /data1/dn2 shell>ls -l --hide=D* ndb_3_fslrwxrwxrwx 1 user group 30 2007-03-19 14:22 dd -> /data1/dn3
Now you can create a logfile group and tablespace using the symbolic link, like this:
mysql>CREATE LOGFILE GROUP lg1->ADD UNDOFILE 'dd/undo1.log'->INITIAL_SIZE 150M->UNDO_BUFFER_SIZE = 1M->ENGINE=NDBCLUSTER;mysql>CREATE TABLESPACE ts1->ADD DATAFILE 'dd/data1.log'->USE LOGFILE GROUP lg1->INITIAL_SIZE 1G->ENGINE=NDBCLUSTER;
Verify that the files were created and placed correctly as shown here:
shell>cd /data1shell>lsdn2 dn3 shell>ls dn2undo1.log data1.log shell>ls dn3undo1.log data1.log