Windows环境下配置MySQL Cluster
一、准备工作 首先得准备好硬件设施、我这里是3台机器在做群集、结构如下: 管理节点(MGM) 172.16.0.162(db1) SQL节点1(SQL1) 172.16.0.161(db2) SQL节点2(SQL2) 172.16.0.202(db3) 数据节点1(NDBD1) 172.16.0.161(db4) 数据节点2(NDBD2) 172.16.0.202(db4)
一、准备工作
首先得准备好硬件设施、我这里是3台机器在做群集、结构如下:
管理节点(MGM) 172.16.0.162(db1)
SQL节点1(SQL1) 172.16.0.161(db2)
SQL节点2(SQL2) 172.16.0.202(db3)
数据节点1(NDBD1) 172.16.0.161(db4)
数据节点2(NDBD2) 172.16.0.202(db4)
这个硬件搞定了、现在搞软件
最好下载7以上的版本、因为性能好嘛,7.2这个版本的新特性上介绍说是:自适应查询本地化(AQL) 复杂连接速度提高70多倍。当然到底是不是这样我没有测试过不清楚。
二、安装软件
解压mysql-cluster-gpl-7.2.9-win32.zip包
Management node的安装配置。
Management node一定要安装在C盘下,并且是以下的目录(这是在运行此节点时报错,说找不到相对应的目录)。在IP为172.16.0.162的机子上
生成c:/mysql/bin、C:/mysql/mysql-cluster(第一次启动后在这个文件夹会生成类似ndb_1_config.bin.1的文件,好像是为了以后启动加载的配置)
和c:/mysql/bin/cluster-logs目录,在下载解压的文件目录mysql/bin中将ndb_mgmd.exe和ndb_mgm.exe复制到172.16.0.162的c:/mysql/bin目录下。
在172.16.0.162的c:/mysql/bin下生成两个文件,my.ini和config.ini。
my.ini的内容为:
[plain]view plaincopyprint?
[mysql_cluster]
# Options for management node process
config-file=C:/mysql/bin/config.ini
[mysql_cluster] # Options for management node process config-file=C:/mysql/bin/config.ini
config.ini的内容:(注:ID不能从0开始,必须大于0)
[html]view plaincopyprint?
[NDBD DEFAULT]
NoOfReplicas=2
DataDir=D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data
DataMemory=80M
IndexMemory=18M
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
[NDB_MGMD]
ID=1
HostName=172.16.0.162 #管理节点服务器
# Storage Engines
DataDir=C:/mysql/bin/cluster-logs
[NDBD]
ID=2
HostName=172.16.0.161 #MySQL集群db1的IP地址
#DataDir= D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data #如果不存在就创建一个
[NDBD]
ID=3
HostName=172.16.0.202 #MySQL集群db2的IP地址
#DataDir= D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data #如果不存在就创建一个
[MYSQLD]
ID=4
HostName=172.16.0.161
[MYSQLD]
ID=5
HostName=172.16.0.202
[NDBD DEFAULT]NoOfReplicas=2DataDir=D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-dataDataMemory=80MIndexMemory=18M[MYSQLD DEFAULT][NDB_MGMD DEFAULT][TCP DEFAULT][NDB_MGMD]ID=1HostName=172.16.0.162 #管理节点服务器# Storage EnginesDataDir=C:/mysql/bin/cluster-logs[NDBD]ID=2HostName=172.16.0.161 #MySQL集群db1的IP地址#DataDir= D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data #如果不存在就创建一个[NDBD]ID=3HostName=172.16.0.202 #MySQL集群db2的IP地址#DataDir= D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data #如果不存在就创建一个[MYSQLD]ID=4HostName=172.16.0.161[MYSQLD]ID=5HostName=172.16.0.202
Data nodes的安装配置
在IP为172.16.0.161 的机子上生成D:/Program Files/mysqlcluster/datanode/mysql/bin、D:/Program Files/mysqlcluster/datanode/mysql/cluster-data、
D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data.在下载的的解压文件夹/bin中将ndbd.exe复制到
172.16.0.161 机子的D:/Program Files/mysqlcluster/datanode/mysql /bin目录下,
并在D:/Program Files/mysqlcluster/datanode/mysql/bin目录下生成my.ini文件,文件的内容为:
[html]view plaincopyprint?
[mysql_cluster]
# Options for data node process:
ndb-connectstring=172.16.0.162 # location of management server
[mysql_cluster] # Options for data node process:ndb-connectstring=172.16.0.162 # location of management server 同理在172.16.0.202机子上配置相同的配置,也可以直接复制到172.16.0.202机子上。
SQL node的安装配置
在IP为172.16.0.161的机子上生成D:/Program Files/mysqlcluster/sqlnode目录,将下载的解压文件夹直接整个复制到D:/ProgramFiles/mysqlcluster/sqlnode/mysql目录下,在D:/ProgramFiles/mysqlcluster/sqlnode/mysql下生成my.ini文件,文件内容为:
[html]view plaincopyprint?
[html]view plaincopyprint?
[mysqld]
# Options for mysqld process:ndbcluster
[mysqld] # Options for mysqld process:ndbcluster
[html]view plaincopyprint?
# run NDB storage engine
ndb-connectstring=172.16.0.154
# location of management server
# run NDB storage engine ndb-connectstring=172.16.0.154 # location of management server同理,将D:/Program Files/mysqlcluster/sqlnode整个文件夹复制到172.16.0.202机子的相同目录下。
三、启动集群
启动各个节点是有顺序的,先是Management node,然后是Data nodes,最后是SQL nodes。
a、启动Management node在172.16.0.162机子下进入命令行,,转到c:/mysql/bin目录下,输入:
ndb_mgmd -f config.ini
(
如果报如下错误:MySQL Cluster Management Server mysql-5.5.28 ndb-7.2.9
2013-05-03 10:13:10 [MgmtSrvr] INFO -- The default config directory 'C:/Prog
ram Files/MySQL/MySQL Server 5.5/mysql-cluster' does not exist. Trying to create
it...
Failed to create directory 'C:/Program Files/MySQL/MySQL Server 5.5/mysql-cluste
r', error: 3
2013-05-03 10:13:10 [MgmtSrvr] ERROR -- Could not create directory 'C:/Progra
m Files/MySQL/MySQL Server 5.5/mysql-cluster'. Either create it manually or spec
ify a different directory with --configdir=
则在创建如下文件夹:C:Program FilesMySQLMySQL Server 5.5
)
b、启动Data node
在172.16.0.161机子下进入命令行,转到D:/Program Files/mysqlcluster/datanode/mysql/bin目录下,输入:
ndbd --connect-string="nodeid2;host=172.16.0.162:1186"
同理启动172.16.0.202机子,nodeid2是根据管理节点的配置文件
config.ini中的id决定的,如果id为2,则为nodeid2,配置文件中未指定
id,则按顺序执行。
(注)此时可通过在Management node中新开一命令行,转到
c:/mysql/bin目录下输入命令:
ndb_mgm
启动ndb_mgm.exe,之后输入命令:
ALL STATUS
查看到Data node连接是否成功.之后启动正常之后才能继续启动
SQLnode
c、启动SQL node
在172.16.0.161机子下进入命令行,转到D:/Program
Files/mysqlcluster/sqlnode/mysql/bin目录下,输入:
mysqld --console
按相同方式启动172.16.0.202下的SQL node。
(注):可通过在Management node节点的机器下,转到c:/mysql/bin目录
下输入命令:
ndb_mgm
启动ndb_mgm.exe,之后输入命令:
SHOW
即可查看到各个节点的连接情况。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.
