Description: The MySQL management node and data node are configured as Windows services to prevent manually shutting down the management node or the data node of the DOS command window, the management node or the data node of the command window may cause a MySQL or some MySQL can not be accessed, Registering as a Windows service automatically starts more secure and reliable.
Directory
Operating system: Windows Server R2 Enterprise
VM1:192.168.220.103 Management node (MGM),
VM2:192.168.220.104 Data Node (NDBD1), SQL node (SQL1)
vm3:192.168.220.108 Data Node (NDBD2), SQL node (SQL2)
MySQL cluster version: 7.3.7 (MSI Installer)
Related knowledge
Brief introduction:
MySQL Cluster is a technology that allows the Cluster of an "in-memory" database to be deployed in a system that is not shared. With no shared architecture, the system can use inexpensive hardware and has no special requirements for hardware and software. In addition, because each component has its own memory and disk, there is no single point of failure.
MySQL Cluster is made up of a group of computers, each running a variety of processes, including MySQL server, NDB Cluster data node, Management Server, and (possibly) specialized data access program
Three types of nodes:
Management node: Used to manage the cluster common node; daemon NDB_MGMD
Data node: The data used to hold the cluster; Daemon NDBD
SQL node: Used to connect data nodes; Daemon mysqld
For details, refer to the MySQL cluster chapter in the reference manual.
Configuration process
Installing MySQL Cluster (mysql-cluster-gpl-7.3.7-winx64) on VM1,VM2,VM3
Select Typical installation, the installation directory is: C:\Program files\mysql\mysql Cluster 7.3
In Windows Explorer on VM1,VM2,VM3, open C:\Program files\mysql, in this directory, create a new folder in MySQL server 5.6, and then in the new MySQL server 5.6 New Mysql-cluster folder under Folder
The path to the new folder is: C:\Program files\mysql\mysql Server 5.6
C:\Program Files\mysql\mysql Server 5.6\mysql-cluster
In VM1 Windows Explorer Open Directory \ c, create a MySQL directory and a new Config.ini file in this directory (the full directory is C:\MySQL\config.ini)
[ndbd Default]Noofreplicas=2Maxnooftables=1024x768maxnoofuniquehashindexes=1024x768maxnooforderedindexes=1024x768maxnoofattributes=10000[NDB_MGMD]NodeId=1HostName=192.168.220.103DataDir=C:\Program Files\mysql\mysql Cluster7.3\data[NDBD]NodeId= +HostName=192.168.220.104DataDir=C:\Program Files\mysql\mysql Server5.6\mysql-Cluster[NDBD]NodeId= AHostName=192.168.220.108DataDir=C:\Program Files\mysql\mysql Server5.6\mysql-Cluster[mysqld]NodeId= OneHostName=192.168.220.104[mysqld]NodeId= AHostName=192.168.220.108
Open Directory C:\Program files\mysql\mysql Cluster 7.3 in VM1,VM2,VM3 Explorer and create a new My.ini file in this directory
[mysqld]Character_set_server=UTF8 Basedir="C:\Program Files\mysql\mysql Cluster7.3"DataDir="C:\Program Files\mysql\mysql Cluster7.3\data "Sql_mode=no_engine_substitution,strict_trans_tables ndbclusterndb-ConnectString=192.168.220.103Explicit_defaults_for_timestamp=true[Mysql_cluster]NDB-ConnectString=192.168.220.103
Set environment variables in VM1 and VM2 (not required, not in the text, CD to the appropriate directory to execute commands)
Computer Right-click Properties (or Control Panel \ System and Security \ System)---> Advanced system Configuration---> Advanced selection Card---> Environment variables---> System variables find path---> Edit---> Plus C:\Program Files\mysql\mysql Cluster 7.3\bin
Note: Multiple paths are separated by semicolons
Configuration file Main Parameters Introduction:
[NDBD]: Defines the data node of the cluster
[MYSQLD]: Defines the MySQL server node for the cluster
[MGM] or [NDB_MGMD]: Defines the Management Server node for the cluster
[NDB_MGMD] ID: node-unique identity
[NDBD] Noofreplicas: The global parameter can only be set in [NDBD DEFAULT], which defines the number of copies saved per table in the cluster. This parameter also specifies the size of the node group. A node group refers to a collection of nodes that hold the same information
[NDBD] DataDir: This parameter specifies the directory where trace files, log files, PID files, and error logs are stored
[Mysqld]basedir: Use the specified directory as the root directory
[Mysqld]datadir: Reads a database file using the specified directory
Open the CMD window on the Management node (MGM) machine (VM1) and execute the following command to start the management node
To install the Management node as a Windows service
Skip to the MySQL installation path Bin directory CD "C:\Program files\mysql\mysql Cluster 7.3\bin"
Ndb_mgmd.exe--INSTALL=NDB_MGMD --ndb-mgmd-host=192.168.220.103
--ndb-nodeid=1--config-file= "C:\\mysql\\config.ini"
Parameter description:
--ndb-mgmd-host for Management node IP
--ndb-nodeid for managing nodes in configuration file config.ini on the management node Nodeid
--INSTALL=NDB_MGMD, where NDB_MGMD is the Windows service name
Note: \ \ is required in the path in--config-file, and spaces are not allowed in the path
Start the Management node net start NDB_MGMD
The new CMD window on the Data node (NDBD1) machine (VM2) executes the following command to start the data node
Installing the MYSLQ Data node as a Windows service
CD "C:\Program files\mysql\mysql Cluster 7.3\bin"
Ndbd.exe--install=ndbd--initial (--initial only required for initial execution)
(Note: NDBD is the data node for the Windows service name)
Start Data node net start NDBD
Note:--initial only needs to be executed for the first time, Ndbd.exe can be executed later (refer to the manual should be used when the cluster file needs to be cleaned, so this parameter should be used with caution or early backup)
The new CMD window on the SQL node (SQL1) machine (VM2) executes the following command to start the SQL node
Installing the MySQL SQL node
CD "C:\Program files\mysql\mysql Cluster 7.3\bin"
Mysqld.exe--default-file= "C:\Program files\mysql\mysql Cluster 7.3\my.ini"
Mysqld–install
net start MySQL
Note: Perform mysqld--install you can see a service called "MySQL" on the computer's server, in the execution of net start MySQL, you can see the MySQL service as "boot" status in the service
The new CMD window on the Data node (NDBD2) machine (VM3) executes the following command to start the data node
Installing the MYSLQ Data node as a Windows service
CD "C:\Program files\mysql\mysql Cluster 7.3\bin"
Ndbd.exe--install=ndbd--initial (--initial is required for initial execution, optional)
Start Data node net start NDBD
The new CMD window on the SQL node (SQL2) machine (VM3) executes the following command to start the SQL node
CD "C:\Program files\mysql\mysql Cluster 7.3\bin"
Mysqld.exe--default-file= "C:\Program files\mysql\mysql Cluster 7.3\my.ini"
Mysqld–install
net start MySQL
Check Configuration
Open the CMD window on the Management node (MGM) machine (VM1) to execute the following command
Ndb_mgm.exe
then enter show
The results look similar to the following:
Management node:
192.168.220.103
Data node
192.168.220.104
192.168.220.108
SQL node
192.168.220.104
192.168.220.108
On the 104 machine MySQL create test database test123 and table T1, and then on the landing 108 machine MySQL, check the database test123 and table T1 is synchronized, if synchronized, the MySQL cluster build successfully.
Reference article:
Http://www.cnblogs.com/zhongweiv/p/Windows_Server_2008_R2_MySQL_Cluster.html
Windows Server 2008r2 configures MySQL cluster and configures management nodes and data nodes as Windows services