The performance of a MySQL 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. Previous to MySQL Cluster NDB 6.2.17, MySQL Cluster NDB 6.3.22, and MySQL Cluster NDB 6.4.3, there was no direct support for this in MySQL Cluster, but it was possible to achieve this separation using symbolic links as described in this section.
Beginning with MySQL Cluster NDB 6.2.17, MySQL Cluster NDB
6.3.22, and MySQL Cluster NDB 6.4.3, the data node configuration
parameters FileSystemPathDD
,
FileSystemPathDataFiles
, and
FileSystemPathUndoFiles
make the use of
symbolic links for this purpose unnecessary. For information
about these parameters, see
Disk Data filesystem 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_fs
shell>ls
D1 D10 D11 D2 D8 D9 LCP shell>ln -s /data0 dnlogs
shell>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 /data1
shell>ls -l
total 2099304 -rw-rw-r-- 1 user group 157286400 2007-03-19 14:02 undo1.dat shell>cd /data2
shell>ls -l
total 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 filesystem.
Suppose you are using /data0
for both
data node filesystems, 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 /data0
shell>ln -s /data1/dn2 ndb_2_fs/dd
shell>ln -s /data1/dn3 ndb_3_fs/dd
shell>ls -l --hide=D* ndb_2_fs
lrwxrwxrwx 1 user group 30 2007-03-19 14:22 dd -> /data1/dn2 shell>ls -l --hide=D* ndb_3_fs
lrwxrwxrwx 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 /data1
shell>ls
dn2 dn3 shell>ls dn2
undo1.log data1.log shell>ls dn3
undo1.log data1.log