MySQL: Cluster: Windows environment: built on a computer: 1 Management node, 2 data nodes, 3 mysqld nodes

Source: Internet
Author: User
Tags node server

Hardware condition:

    • IP: 192.168.12.48

 

Software conditions:

    • Mysql-cluster-gpl-7.0.9-win32.msi, installation directory: D: \ Program Files \ mysql server 7.0
    • !!! All subsequent directory settings will be based on the installation directory location !!! For more information about directory settings, see the subsequent configuration file. You must ensure that the directory is valid and exists in advance during your experiments!

 

Management node configuration file:. \ data \ mysql_cfg \ my_cluster.ini

The content is as follows:

Code

  1   [  Ndbd default  ] 
2 Noofreplicas = 2 # The default value is 2.
3 Datadir = D: \ Program Files \ mysql server 7.0 \ Data \ user_data # create
4
5 # Managment Server
6   [ Ndb_mgmd ]
7 Nodeid = 40
8 Hostname = 192.168.12.48 # Manage the IP address of node server db1
9
10 # Storage engines
11   [ Ndbd ]
12 Nodeid = 11
13 Hostname = 192.168.12.48 # IP address of MySQL cluster db1
14   [ Ndbd ]
15 Nodeid = 12
16 Hostname = 192.168.12.48 # IP address of MySQL cluster db3
17
18   [ Mysqld ]
19 Nodeid = 1
20 Hostname = 192.168.12.48
21   [ Mysqld ]
22 Nodeid = 2
23 Hostname = 192.168.12.48
24   [ Mysqld ]
25 Nodeid = 3
26 Hostname = 192.168.12.48

 

Start Management Service:

"D: \ Program Files \ mysql server 7.0 \ bin \ ndb_mgmd.exe" -- config-file = "D: /program files/MySQL Server 7.0/data/mysql_cfg/my_cluster.ini "-- Initial

 

Start the management client, in the show status:

  -- NDB Cluster -- management client --
Ndb_mgm> show
Connected to management server at: localhost: 1186
Cluster configuration
---------------------
[ Ndbd (NDB) ] 2 Node (s)
ID = 11 (Not connected , Accepting connect from 192.168.12.48 )
ID = 12 (Not connected , Accepting connect from 192.168.12.48 )

[ Ndb_mgmd (MGM) ] 1 Node (s)
ID = 40 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 )

[ Mysqld (API) ] 3 Node (s)
ID = 1 (Not connected , Accepting connect from 192.168.12.48 )
ID = 2 (Not connected , Accepting connect from 192.168.12.48 )
ID = 3 (Not connected , Accepting connect from 192.168.12.48 )

Ndb_mgm> node 11 : Started (Version 7.0.9 )
Node 12 : Started (Version 7.0.9 )

 

 

Configure node1 and use the common configuration file to configure the data node and mysqld node:. \ data \ user_data \Node1 \ my_node1.ini

The content is as follows:

Node configuration: ndbd and mysqld

  #
[ Mysqld ]
Basedir = " D:/program files/MySQL Server 7.0 "
Default-character-Set = Utf8
Default-storage-engine = Ndbcluster
SQL-Mode = " Strict_trans_tables, no_auto_create_user, no_engine_substitution "
Port = 33061
Datadir = " D:/program files/MySQL Server 7.0/data/user_data/Node1/ "
General_log_file = " D:/program files/MySQL Server 7.0/data/user_data/Node1/General_log.log "
#
Ndbcluster
Ndb_connectstring = " 192.168.12.48 "
#
Skip_innodb
#
[ Ndbd ]
Ndb_connectstring = " 192.168.12.48 "

Node2 and node3 are set similarly: Pay attention to the red part, and change the port to 33062 or 33063. Set 1 in the path string to 2 or 3.

Reminder again: the path must exist !!!!!!!!!!!!

Tip: [ndbd] is not available in the node3 configuration file. Of course, you can set it as long as ndbd is not started.ProgramJust do it. Set it to be nice-looking and unified.

 

 

Next: MySQL basic database [MySQL] -- the location set when installing mysql-cluster-gpl-7.0.9-win32.msi software, do not know Ah-Folder copy to node 1 respectively D:/program files/MySQL Server 7.0/data/user_data/Node1Is similar:  D:/program files/MySQL Server 7.0/data/user_data/Node1\ Mysql \

In the same way, copy to the data folders of Node 2 and node 3.

 

Start the data node Node 1: "D: \ Program Files \ mysql server 7.0 \ bin \ ndbd.exe" -- defaults-file = "D: \ Program Files \ mysql server 7.0 \ data \ user_data \ node1 \ my_node1.ini"

Start the data node Node 2: "D: \ Program Files \ mysql server 7.0 \ bin \ ndbd.exe" -- defaults-file = "D: \ Program Files \ mysql Server7.0 \ data \ user_data \ node2 \ my_node2.ini"

 

 

Start mysqld node Node 1: "D: \ Program Files \ mysql server 7.0 \ bin \ mysqld.exe" -- defaults-file = "D: \ Program Files \ mysql server 7.0 \ data \ user_data \ node1 \ my_node1.ini "-- Console

Start mysqld node Node 2: "D: \ Program Files \ mysql Server7.0 \ bin \ mysqld.exe" -- defaults-file = "D: \ Program Files \ mysql server 7.0 \ data \ user_data \ node2 \ my_node2.ini "-- Console

Start mysqld node Node 3: "D: \ Program Files \ mysql Server7.0 \ bin \ mysqld.exe" -- defaults-file = "D: \ Program Files \ mysql server 7.0 \ data \ user_data \ node3 \ my_node3.ini "-- Console

 

There should be no problem: You can finally show the status in the cluster management client:

Complete cluster configuration

  Ndb_mgm> show
Cluster configuration
---------------------
[ Ndbd (NDB) ] 2 Node (s)
ID = 11 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 , Nodegroup: 0 , Master)
ID = 12 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 , Nodegroup: 0 )

[ Ndb_mgmd (MGM) ] 1 Node (s)
ID = 40 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 )

[ Mysqld (API) ] 3 Node (s)
ID = 1 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 )
ID = 2 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 )
ID = 3 @ 192.168.12.48 (MySQL- 5.1.39 NDB- 7.0.9 )

 

 

OK. If so, you have succeeded!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.