Spec-Zone .ru
спецификации, руководства, описания, API
|
This section describes a basic installation of MySQL Cluster on Windows using a binary no-install
MySQL Cluster release provided by Oracle, using the same 4-node setup outlined in the beginning of this section
(see Section 17.2, "MySQL Cluster Installation"), as shown in
the following table:
Node | IP Address |
---|---|
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 |
As on other platforms, the MySQL Cluster host computer running an SQL node must have installed on it a MySQL Server binary (mysqld.exe). You should also have the MySQL client (mysql.exe) on on this host. For management nodes and data nodes, it is not necessary to install the MySQL Server binary; however, each management node requires the management server daemon (ndb_mgmd.exe); each data node requires the data node daemon (ndbd.exe or ndbmtd.exe). For this example, we refer to ndbd.exe as the data node executable, but you can install ndbmtd.exe, the multi-threaded version of this program, instead, in exactly the same way. You should also install the management client (ndb_mgm.exe) on the management server host. This section covers the steps necessary to install the correct Windows binaries for each type of MySQL Cluster node.
As with other Windows programs, MySQL Cluster executables are named with the .exe
file extension. However, it is not necessary to include the .exe
extension when invoking these programs from the command line. Therefore, we
often simply refer to these programs in this documentation as mysqld, mysql, ndb_mgmd, and so on. You should understand that, whether
we refer (for example) to mysqld or mysqld.exe, either name means the same thing (the MySQL
Server program).
For setting up a MySQL Cluster using Oracles's no-install
binaries, the first step
in the installation process is to download the latest MySQL Cluster Windows binary archive from mysql-cluster-gpl-noinstall-
,
where ver
-winarch
.zipver
is the NDB
storage engine
version (such as 7.3.1
), and arch
is the
architecture (32
for 32-bit binaries, and 64
for
64-bit binaries). For example, the MySQL Cluster NDB 7.3.1 no-install
archive for
32-bit Windows systems is named mysql-cluster-gpl-noinstall-7.3.1-win32.zip
.
You can run 32-bit MySQL Cluster binaries on both 32-bit and 64-bit versions of Windows; however, 64-bit MySQL Cluster binaries can be used only on 64-bit versions of Windows. If you are using a 32-bit version of Windows on a computer that has a 64-bit CPU, then you must use the 32-bit MySQL Cluster binaries.
To minimize the number of files that need to be downloaded from the Internet or copied between machines, we start with the computer where you intend to run the SQL node.
SQL node. We assume that you have placed a copy of the no-install
archive in
the directory C:\Documents and Settings\
on the computer having the
IP address 192.168.0.20, where username
\My Documents\Downloadsusername
is the name of the current
user. (You can obtain this name using ECHO %USERNAME%
on the command line.) To
install and run MySQL Cluster executables as Windows services, this user should be a member of the Administrators
group.
Extract all the files from the archive. The Extraction Wizard integrated with Windows Explorer is adequate for
this task. (If you use a different archive program, be sure that it extracts all files and directories from the
archive, and that it preserves the archive's directory structure.) When you are asked for a destination
directory, enter C:\
, which causes the Extraction Wizard to extract the archive to
the directory C:\mysql-cluster-gpl-noinstall-
.
Rename this directory to ver
-winarch
C:\mysql
.
It is possible to install the MySQL Cluster binaries to directories other than C:\mysql\bin
;
however, if you do so, you must modify the paths shown in this procedure accordingly. In particular, if the
MySQL Server (SQL node) binary is installed to a location other than C:\mysql
or
C:\Program Files\MySQL\MySQL Server 5.6
, or if the SQL node's data directory is in
a location other than C:\mysql\data
or C:\Program
Files\MySQL\MySQL Server 5.6\data
, extra configuration options must be used on the command line or
added to the my.ini
or my.cnf
file when starting the
SQL node. For more information about configuring a MySQL Server to run in a nonstandard location, see Section 2.3.5,
"Installing MySQL on Microsoft Windows Using a noinstall
Zip Archive".
For a MySQL Server with MySQL Cluster support to run as part of a MySQL Cluster, it must be started with the
options --ndbcluster
and --ndb-connectstring
. While you can specify these options on the command line,
it is usually more convenient to place them in an option file. To do this, create a new text file in Notepad or
another text editor. Enter the following configuration information into this file:
[mysqld]# Options for mysqld process:ndbcluster # run NDB storage enginendb-connectstring=192.168.0.10 # location of management server
You can add other options used by this MySQL Server if desired (see Section
2.3.5.2, "Creating an Option File"), but the file must contain the options shown, at a minimum. Save this
file as C:\mysql\my.ini
. This completes the installation and setup for the SQL
node.
Data nodes. A MySQL Cluster data node on a Windows host requires only a single executable, one of either
ndbd.exe or ndbmtd.exe. For this example, we assume that you are using
ndbd.exe, but the same instructions apply when using ndbmtd.exe. On each computer where you wish to run a data
node (the computers having the IP addresses 192.168.0.30 and 192.168.0.40), create the directories C:\mysql
, C:\mysql\bin
, and C:\mysql\cluster-data
; then, on the computer where you downloaded and extracted
the no-install
archive, locate ndbd.exe
in the C:\mysql\bin
directory. Copy this file to the C:\mysql\bin
directory on each of the two data node hosts.
To function as part of a MySQL Cluster, each data node must be given the address or hostname of the management
server. You can supply this information on the command line using the --ndb-connectstring
or -c
option when starting
each data node process. However, it is usually preferable to put this information in an option file. To do this,
create a new text file in Notepad or another text editor and enter the following text:
[mysql_cluster]# Options for data node process:ndb-connectstring=192.168.0.10 # location of management server
Save this file as C:\mysql\my.ini
on the data node host. Create another text file
containing the same information and save it on as C:mysql\my.ini
on the other data
node host, or copy the my.ini file from the first data node host to the second one, making sure to place the
copy in the second data node's C:\mysql
directory. Both data node hosts are now
ready to be used in the MySQL Cluster, which leaves only the management node to be installed and configured.
Management node. The only executable program required on a computer used for hosting a MySQL Cluster
management node is the management server program ndb_mgmd.exe. However, in order to administer the MySQL
Cluster once it has been started, you should also install the MySQL Cluster management client program ndb_mgm.exe on the same machine as the management server.
Locate these two programs on the machine where you downloaded and extracted the no-install
archive; this should be the directory C:\mysql\bin
on the SQL node host. Create the directory C:\mysql\bin
on the computer having the
IP address 192.168.0.10, then copy both programs to this directory.
You should now create two configuration files for use by ndb_mgmd.exe
:
A local configuration file to supply configuration data specific to the management node itself. Typically, this file needs only to supply the location of the MySQL Cluster global configuration file (see item 2).
To create this file, start a new text file in Notepad or another text editor, and enter the following information:
[mysql_cluster]# Options for management node processconfig-file=C:/mysql/bin/config.ini
Save this file as the plaintext file C:\mysql\bin\my.ini
.
A global configuration file from which the management node can obtain configuration
information governing the MySQL Cluster as a whole. At a minimum, this file must contain a section for
each node in the MySQL Cluster, and the IP addresses or hostnames for the management node and all data
nodes (HostName
configuration parameter). It is also advisable to include
the following additional information:
The IP address or hostname of any SQL nodes
The data memory and index memory allocated to each data node (DataMemory
and IndexMemory
configuration parameters)
The number of replicas, using the NoOfReplicas
configuration parameter (see Section
17.1.2, "MySQL Cluster Nodes, Node Groups, Replicas, and Partitions")
The directory where each data node stores it data and log file, and the
directory where the management node keeps its log files (in both cases, the DataDir
configuration parameter)
Create a new text file using a text editor such as Notepad, and input the following information:
[ndbd default]# Options affecting ndbd processes on all data nodes:NoOfReplicas=2 # Number of replicasDataDir=C:/mysql/bin/cluster-data # Directory for each data node's data files # Forward slashes used in directory path, # rather than backslashes. This is correct; # see Important note in textDataMemory=80M # Memory allocated to data storageIndexMemory=18M # Memory allocated to index storage # For DataMemory and IndexMemory, we have used the # default values. Since the "world" database takes up # only about 500KB, this should be more than enough for # this example Cluster setup.[ndb_mgmd]# Management process options:HostName=192.168.0.10 # Hostname or IP address of management nodeDataDir=C:/mysql/bin/cluster-logs # Directory for management node log files[ndbd]# Options for data node "A": # (one [ndbd] section per data node)HostName=192.168.0.30 # Hostname or IP address[ndbd]# Options for data node "B":HostName=192.168.0.40 # Hostname or IP address[mysqld]# SQL node options:HostName=192.168.0.20 # Hostname or IP address
Save this file as the plaintext file C:\mysql\bin\config.ini
.
A single backslash character (\
) cannot be used when specifying
directory paths in program options or configuration files used by MySQL Cluster on Windows. Instead, you
must either escape each backslash character with a second backslash (\\
), or
replace the backslash with a forward slash character (/
). For example, the
following line from the [ndb_mgmd]
section of a MySQL Cluster config.ini
file does not work:
DataDir=C:\mysql\bin\cluster-logs
Instead, you may use either of the following:
DataDir=C:\\mysql\\bin\\cluster-logs # Escaped backslashes
DataDir=C:/mysql/bin/cluster-logs # Forward slashes
For reasons of brevity and legibility, we recommend that you use forward slashes in directory paths used in MySQL Cluster program options and configuration files on Windows.