Table of Contents [+/-]
This section is a “How-To” that describes the basics for how to plan, install, configure, and run a MySQL Cluster. Whereas the examples in Chapter 3, MySQL Cluster Configuration provide more in-depth information on a variety of clustering options and configuration, the result of following the guidelines and procedures outlined here should be a usable MySQL Cluster which meets the minimum requirements for availability and safeguarding of data.
This section covers hardware and software requirements; networking issues; installation of MySQL Cluster; configuration issues; starting, stopping, and restarting the cluster; loading of a sample database; and performing queries.
Basic assumptions. This How-To makes the following assumptions:
The cluster is to be set up with four nodes, each on a separate host, and each with a fixed network address on a typical Ethernet network as shown here:
|Management (MGMD) node||192.168.0.10|
|MySQL server (SQL) node||192.168.0.20|
|Data (NDBD) node "A"||192.168.0.30|
|Data (NDBD) node "B"||192.168.0.40|
This may be made clearer in the following diagram:
In the interest of simplicity (and reliability), this
How-To uses only numeric IP addresses.
However, if DNS resolution is available on your network, it is
possible to use host names in lieu of IP addresses in
configuring Cluster. Alternatively, you can use the
/etc/hosts file or your operating
system's equivalent for providing a means to do host lookup
if such is available.
A common problem when trying to use host names for Cluster
nodes arises because of the way in which some operating
systems (including some Linux distributions) set up the
system's own host name in the
during installation. Consider two machines with the host names
ndb2, both in
cluster network domain. Red Hat Linux
(including some derivatives such as CentOS and Fedora) places
the following entries in these machines'
/etc/hosts: 127.0.0.1 ndb1.cluster ndb1 localhost.localdomain localhost
/etc/hosts: 127.0.0.1 ndb2.cluster ndb2 localhost.localdomain localhost
SUSE Linux (including OpenSUSE) places these entries in the
/etc/hosts: 127.0.0.1 localhost 127.0.0.2 ndb1.cluster ndb1
/etc/hosts: 127.0.0.1 localhost 127.0.0.2 ndb2.cluster ndb2
In both instances,
ndb1.cluster to a loopback IP address, but
gets a public IP address from DNS for
ndb2.cluster to a loopback address
and obtains a public address for
ndb1.cluster. The result is that each data
node connects to the management server, but cannot tell when
any other data nodes have connected, and so the data nodes
appear to hang while starting.
You should also be aware that you cannot mix
localhost and other host names or IP
config.ini. For these
reasons, the solution in such cases (other than to use IP
addresses for all
entries) is to remove the fully qualified host names from
/etc/hosts and use these in
config.ini for all cluster hosts.
Each host in our scenario is an Intel-based desktop PC running a common, generic Linux distribution installed to disk in a standard configuration, and running no unnecessary services. The core OS with standard TCP/IP networking capabilities should be sufficient. Also for the sake of simplicity, we also assume that the file systems on all hosts are set up identically. In the event that they are not, you will need to adapt these instructions accordingly.
Standard 100 Mbps or 1 gigabit Ethernet cards are installed on each machine, along with the proper drivers for the cards, and that all four hosts are connected via a standard-issue Ethernet networking appliance such as a switch. (All machines should use network cards with the same throughout. That is, all four machines in the cluster should have 100 Mbps cards or all four machines should have 1 Gbps cards.) MySQL Cluster will work in a 100 Mbps network; however, gigabit Ethernet will provide better performance.
Note that MySQL Cluster is not intended for use in a network for which throughput is less than 100 Mbps. For this reason (among others), attempting to run a MySQL Cluster over a public network such as the Internet is not likely to be successful, and is not recommended.
For our sample data, we will use the
database which is available for download from the MySQL Web
site. As this database takes up a relatively small amount of
space, we assume that each machine has 256MB RAM, which should
be sufficient for running the operating system, host NDB
process, and (for the data nodes) for storing the database.
Although we refer to a Linux operating system in this How-To, the instructions and procedures that we provide here should be easily adaptable to other supported operating systems. We also assume that you already know how to perform a minimal installation and configuration of the operating system with networking capability, or that you are able to obtain assistance in this elsewhere if needed.
For information about MySQL Cluster hardware, software, and networking requirements, see Section 1.3, “MySQL Cluster Hardware, Software, and Networking Requirements”.