Each MySQL Cluster host computer running an SQL node must have installed on it a MySQL binary. For management nodes and data nodes, it is not necessary to install the MySQL server binary, but management nodes require the management server daemon (ndb_mgmd) and data nodes require the data node daemon (ndbd). It is also a good idea to install the management client (ndb_mgm) on the management server host. This section covers the steps necessary to install the correct binaries for each type of Cluster node.
Sun Microsystems, Inc. provides precompiled binaries that support
Cluster, and there is generally no need to compile these yourself.
However, we also include information relating to installing a
MySQL Cluster after building MySQL from source. For setting up a
cluster using MySQL's binaries, the first step in the
installation process for each cluster host is to download the file
mysql-max-4.1.26-pc-linux-gnu-i686.tar.gz
from the MySQL downloads
area. We assume that you have placed it in each machine's
/var/tmp
directory. (If you do require a
custom binary, see Section 2.9.3, “Installing from the Development Source Tree”.)
RPMs are also available for both 32-bit and 64-bit Linux platforms. For a MySQL Cluster, four RPMs are required:
The Server RPM (for example,
MySQL-server-4.1.26-0.glibc23.i386.rpm
),
which supplies the core files needed to run a MySQL Server.
The Server/Max RPM (for
example,
MySQL-Max-4.1.26-0.glibc23.i386.rpm
),
which provides a MySQL Server binary with clustering support.
The NDB Cluster - Storage
engine RPM (for example,
MySQL-ndb-storage-4.1.26-0.glibc23.i386.rpm
),
which supplies the MySQL Cluster data node binary
(ndbd).
The NDB Cluster - Storage engine
management RPM (for example,
MySQL-ndb-management-4.1.26-0.glibc23.i386.rpm
),
which provides the MySQL Cluster management server binary
(ndb_mgmd).
In addition, you should also obtain the NDB
Cluster - Storage engine basic tools RPM (for example,
MySQL-ndb-tools-4.1.26-0.glibc23.i386.rpm
),
which supplies several useful applications for working with a
MySQL Cluster. The most important of these is the MySQL Cluster
management client (ndb_mgm). The
NDB Cluster - Storage engine extra
tools RPM (for example,
MySQL-ndb-extra-4.1.26-0.glibc23.i386.rpm
)
contains some additional testing and monitoring programs, but is
not required to install a MySQL Cluster. (For more information
about these additional programs, see
Section 15.4, “MySQL Cluster Programs”.)
The MySQL version number in the RPM file names (shown here as
4.1.26
) can vary according to the
version which you are actually using. It is very
important that all of the Cluster RPMs to be installed have the
same MySQL version number. The glibc
version number (if present — shown here as
glibc23
), and architecture designation (shown
here as i386
) should be appropriate to the
machine on which the RPM is to be installed.
See Section 2.4, “Installing MySQL from RPM Packages on Linux”, for general information about installing MySQL using RPMs supplied by Sun Microsystems, Inc.
After installing from RPM, you still need to configure the cluster as discussed in Section 15.2.2, “MySQL Cluster Multi-Computer Configuration”.
After completing the installation, do not yet start any of the binaries. We show you how to do so following the configuration of all nodes.
Data and SQL Node Installation — .tar.gz
Binary.
On each of the machines designated to host data or SQL nodes,
perform the following steps as the system
root
user:
Check your /etc/passwd
and
/etc/group
files (or use whatever
tools are provided by your operating system for managing
users and groups) to see whether there is already a
mysql
group and
mysql
user on the system. Some OS
distributions create these as part of the operating system
installation process. If they are not already present,
create a new mysql
user group, and then
add a mysql
user to this group:
shell>groupadd mysql
shell>useradd -g mysql mysql
The syntax for useradd and groupadd may differ slightly on different versions of Unix, or they may have different names such as adduser and addgroup.
Change location to the directory containing the downloaded
file, unpack the archive, and create a symlink to the
mysql-max
directory named
mysql
. Note that the actual file and
directory names will vary according to the MySQL version
number.
shell>cd /var/tmp
shell>tar -C /usr/local -xzvf mysql-max-4.1.26-pc-linux-gnu-i686.tar.gz
shell>ln -s /usr/local/mysql-max-4.1.26-pc-linux-gnu-i686 /usr/local/mysql
Change location to the mysql
directory and run the supplied script for creating the
system databases:
shell>cd mysql
shell>scripts/mysql_install_db --user=mysql
Set the necessary permissions for the MySQL server and data directories:
shell>chown -R root .
shell>chown -R mysql data
shell>chgrp -R mysql .
Note that the data directory on each machine hosting a
data node is /usr/local/mysql/data
.
This piece of information is essential when configuring
the management node. (See
Section 15.2.2, “MySQL Cluster Multi-Computer Configuration”.)
Copy the MySQL startup script to the appropriate directory, make it executable, and set it to start when the operating system is booted up:
shell>cp support-files/mysql.server /etc/rc.d/init.d/
shell>chmod +x /etc/rc.d/init.d/mysql.server
shell>chkconfig --add mysql.server
(The startup scripts directory may vary depending on your
operating system and version — for example, in some
Linux distributions, it is
/etc/init.d
.)
Here we use Red Hat's chkconfig for creating links to the startup scripts; use whatever means is appropriate for this purpose on your operating system and distribution, such as update-rc.d on Debian.
Remember that the preceding steps must be performed separately on each machine where an SQL node is to reside.
SQL node installation — RPM files. On each machine to be used for hosting a cluster SQL node, install the MySQL Max RPM by executing the following command as the system root user, replacing the name shown for the RPM as necessary to match the name of the RPM downloaded from the MySQL web site:
shell>rpm -Uhv MySQL-server-4.1.26-0.glibc23.i386.rpm
shell>rpm -Uhv MySQL-Max-4.1.26-0.glibc23.i386.rpm
This installs the MySQL Max server binary
(mysqld-max) in the
/usr/sbin
directory, as well as all needed
MySQL Server support files. It also installs the
mysql.server and
mysqld_safe startup scripts in
/usr/share/mysql
and
/usr/bin
, respectively. The RPM installer
should take care of general configuration issues (such as
creating the mysql
user and group, if needed)
automatically.
SQL node installation — building from source.
If you compile MySQL with clustering support (for example, by
using the
BUILD/compile-platform_name
-max
script appropriate to your platform), and perform the default
installation (using make install as the root
user), mysqld is placed in
/usr/local/mysql/bin
. Follow the steps
given in Section 2.9, “MySQL Installation Using a Source Distribution” to make
mysqld ready for use. If you want to run
multiple SQL nodes, you can use a copy of the same
mysqld executable and its associated support
files on several machines. The easiest way to do this is to copy
the entire /usr/local/mysql
directory and
all directories and files contained within it to the other SQL
node host or hosts, then repeat the steps from
Section 2.9, “MySQL Installation Using a Source Distribution” on each machine. If you
configure the build with a nondefault
--prefix
, you need to adjust
the directory accordingly.
Data node installation — RPM Files. On a computer that is to host a cluster data node it is necessary to install only the NDB Cluster - Storage engine RPM. To do so, copy this RPM to the data node host, and run the following command as the system root user, replacing the name shown for the RPM as necessary to match that of the RPM downloaded from the MySQL web site:
shell> rpm -Uhv MySQL-ndb-storage-4.1.26-0.glibc23.i386.rpm
The previous command installs the MySQL Cluster data node binary
(ndbd) in the /usr/sbin
directory.
Data node installation — building from source.
The only executable required on a data node host is
ndbd (mysqld, for example,
does not have to be present on the host machine). By default
when doing a source build, this file is placed in the directory
/usr/local/mysql/libexec
. For installing on
multiple data node hosts, only ndbd need be
copied to the other host machine or machines. (This assumes that
all data node hosts use the same architecture and operating
system; otherwise you may need to compile separately for each
different platform.) ndbd need not be in any
particular location on the host's file system, as long as the
location is known.
Management node installation — .tar.gz
binary.
Installation of the management node does not require the
mysqld binary. Only the binary for the
management server is required, which can be found in the
downloaded archive. You most likely want to install the
management client as well; this can also be found in the
.tar.gz
archive. Again, we assume that you
have placed this archive in /var/tmp
.
As system root
(that is, after using
sudo, su root, or your
system's equivalent for temporarily assuming the system
administrator account's privileges), perform the following steps
to install ndb_mgmd and
ndb_mgm on the Cluster management node host:
Change location to the /var/tmp
directory, and extract the ndb_mgm and
ndb_mgmd from the archive into a suitable
directory such as /usr/local/bin
:
shell>cd /var/tmp
shell>tar -zxvf mysql-4.1.26-pc-linux-gnu-i686.tar.gz
shell>cd mysql-4.1.26-pc-linux-gnu-i686
shell>cp bin/ndb_mgm* /usr/local/bin
(You can safely delete the directory created by unpacking
the downloaded archive, and the files it contains, from
/var/tmp
once
ndb_mgm and ndb_mgmd
have been copied to the executables directory.)
Change location to the directory into which you copied the files, and then make both of them executable:
shell>cd /usr/local/bin
shell>chmod +x ndb_mgm*
Management node installation — RPM file. To install the MySQL Cluster management server, it is necessary only to use the NDB Cluster - Storage engine management RPM. Copy this RPM to the computer intended to host the management node, and then install it by running the following command as the system root user (replace the name shown for the RPM as necessary to match that of the Storage engine management RPM downloaded from the MySQL web site):
shell> rpm -Uhv MySQL-ndb-management-4.1.26-0.glibc23.i386.rpm
This installs the management server binary
(ndb_mgmd) to the
/usr/sbin
directory.
You should also install the NDB
management client, which is supplied by the
Storage engine basic tools RPM.
Copy this RPM to the same computer as the management node, and
then install it by running the following command as the system
root user (again, replace the name shown for the RPM as necessary
to match that of the Storage engine basic
tools RPM downloaded from the MySQL web site):
shell> rpm -Uhv MySQL-ndb-tools-4.1.26-0.glibc23.i386.rpm
The Storage engine basic tools
RPM installs the MySQL Cluster management client
(ndb_mgm) to the /usr/bin
directory.
Management node installation — building from source.
When building from source and running the default make
install, the management server binary
(ndb_mgmd) is placed in
/usr/local/mysql/libexec
, while the
management client binary (ndb_mgm) can be
found in /usr/local/mysql/bin
. Only
ndb_mgmd is required to be present on a
management node host; however, it is also a good idea to have
ndb_mgm present on the same host machine.
Neither of these executables requires a specific location on the
host machine's file system.
In Section 15.2.2, “MySQL Cluster Multi-Computer Configuration”, we create configuration files for all of the nodes in our example Cluster.
User Comments
Add your own comment.