In this recipe, we will be using the RedHat Package Manager (RPM) files provided by MySQL to install a management node on a CentOS 5.3 Linux server. We will be using a x86_64
or 64-bit operating system. However, there is no practical difference between 64-bit and the 32-bit binaries for installation.
At the end of this recipe, you will have a management node installed and ready to start. In the next recipe, we will start the management node, as a running management node is required to check that your storage and SQL nodes start correctly in later recipes.
All files for MySQL Cluster for RedHat and CentOS 5 can be found in the Red Hat Enterprise Linux 5 RPM section from the download page at http://dev.mysql.com. We will first install the management node (the process with which every other cluster node talks to on startup). To get this, download the Cluster storage engine management package MySQL-Cluster-gpl-management-7.a.b-c.rhel5.x86_64.rpm
.
Note
You must use the URL (that is, the address of the mirror site here that you have copied from the MySQL downloads page, which will replace a.mirror
in the following commands). All the other instances where the command wget
is used with the mirror site addresses as a.mirror
should be replaced with the URL.
In the following example, a temporary directory is created and the correct file is downloaded:
[root@node5 ~]# cd ~/ [root@node5 ~]# mkdir mysql [root@node5 ~]# cd mysql [root@node5 mysql]# wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.0/MySQL-Cluster-gpl-management-7.0.6-0.rhel5.x86_64.rpm/from/http://a.mirror/ --16:26:09-- http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.0/MySQL-Cluster-gpl-management-7.0.6-0.rhel5.x86_64.rpm/from/http://a.mirror/ <snip> 16:26:10 (9.78 MB/s) - `MySQL-Cluster-gpl-management-7.0.6-0.rhel5.x86_64.rpm' saved [1316142/1316142]
At the same time of installing the management node, it is also a good idea to install the management client, which we will use to talk to the management node on the same server. This client is contained within the Cluster storage engine basic tools package—MySQL-Cluster-gpl-tools-7.a.b-c.rhel5.x86_64.rpm
, and in the following example this file is downloaded:
[root@node5 ~]# wget http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.0/MySQL-Cluster-gpl-tools-7.0.6-0.rhel5.x86_64.rpm/from/http://a.mirror/ --18:45:57-- http://dev.mysql.com/get/Downloads/MySQL-Cluster-7.0/MySQL-Cluster-gpl-tools-7.0.6-0.rhel5.x86_64.rpm/from/http://a.mirror/ <snip> 18:46:00 (10.2 MB/s) - `MySQL-Cluster-gpl-tools-7.0.6-0.rhel5.x86_64.rpm' saved [9524521/9524521]
Now, install the two files that we have downloaded with the rpm -ivh
command (the flag's meaning –i
for install, –v
for verbose output, and –h
which results in a hash progress bar):
[root@node5 mysql]# rpm -ivh MySQL-Cluster-gpl-management-7.0.6-0.rhel5.x86_64.rpm MySQL-Cluster-gpl-tools-7.0.6-0.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-Cluster-gpl-manage########################################### [100%] 1:MySQL-Cluster-gpl-manage########################################### [100%]
As these two RPM packages are installed, the following binaries are now available on the system:
Type |
Binary |
Description |
---|---|---|
Management |
|
The cluster management server |
Tools |
|
The cluster management client—note that it is not |
Tools |
|
Used for estimating the memory usage of existing databases or tables |
Tools |
|
A tool to provide detailed information about a MySQL Cluster table |
To actually start the cluster, a global configuration file must be created and used to start the management server. As discussed in the previous recipe this file can be called anything and stored anywhere, but by convention it is called config.ini
and stored in /usr/local/mysql-cluster
. For this example, we will use an extremely simple cluster consisting of one management node (10.0.0.5
), two storage nodes (10.0.0.1
and 10.0.0.2
) and two SQL nodes (10.0.0.3
and 10.0.0.4
), but follow the previous recipe (including the There's more… section if you wish to import much data) to create a configuration file tailored to your setup with the correct number of nodes and IP addresses.
Once the contents of the file are prepared, copy it to /usr/local/mysql-cluster/config.ini
. The complete config.ini
file used in this example is as follows:
[ndb_mgmd] Id=1 HostName=10.0.0.5 DataDir=/var/lib/mysql-cluster [ndbd default] DataDir=/var/lib/mysql-cluster NoOfReplicas=2 [ndbd] id=3 HostName=10.0.0.1 [ndbd] id=4 HostName=10.0.0.2 [mysqld] id=11 HostName=10.2.0.3 [mysqld] id=12 HostName=10.2.0.4 [mysqld] id=13 [mysqld] id=14
At this stage, we have installed the management client and server (management node) and created the global configuration file.