windows平台单机多节点mysql群笔记

只是笔记,有需要的可加QQ :644195298一起学习


1,下载mysql-cluster 根据系统版下载对应的版本



管理节点配置


2,在c盘建如下目录 
  C:\mysql\bin 
  C:\mysql\bin\cluster-logs 
  C:\mysql\mysql-cluster
3,将ndb_mgm.exe,ndb_mgmd.exe 复制到C:\mysql\bin 目录下,并在目录下建如下两个文件


config.ini


内容如下
[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]  
nodeId=1  
HostName=127.0.0.1 
# Storage Engines  
DataDir=C:/mysql/bin/cluster-logs  
  
[NDBD]  
nodeId=2  
HostName=127.0.0.1  
DataDir= D:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data  
  
[NDBD]  
nodeId=3  
HostName=127.0.0.1   
DataDir= F:/Program Files/mysqlcluster/datanode/mysql/bin/cluster-data  
  
[MYSQLD]  
nodeId=4  
HostName=127.0.0.1  
  
[MYSQLD]  
nodeId=5  
HostName=127.0.0.1  




my.ini


[mysql_cluster]           
# Options for management node process           
config-file=C:/mysql/bin/config.ini   


启动命令
>cd C:\mysql\bin 
>ndb_mgmd -f config.ini --configdir=C:\mysql\mysql-cluster




数据节点配置[其它节点都是一样的,只需copy]


建如下目录
D:\Program Files\mysqlcluster
D:\Program Files\mysqlcluster\datanode\mysql\bin\cluster-data
D:\Program Files\mysqlcluster\datanode\mysql\cluster-data


复制ndbd.exe 到D:\Program Files\mysqlcluster\datanode\mysql\bin目录下
建my.ini文件
内容如下


[mysql_cluster]    
# Options for data node process:  
db-connectstring=127.0.0.1    
# location of management server 
  
启动命令
>cd D:\Program Files\mysqlcluster\datanode\mysql\bin\
>ndbd --connect-string="nodeid2;host=127.0.0.1:1186"




sql节点配置
建如下目录
D:\Program Files\mysqlcluster\sqlnode
将下载的mysql-cluster改名为mysql拷贝到sqlnode目录下
将原来的my-default.ini删除并创建my.ini文件
my.ini文件内容如下


# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysql_cluster]
ndb-connectstring=localhost


[mysqld]
ndbcluster
# Options for data node process:ndbcluster   
port =3306
ndb-connectstring=127.0.0.1  
 
# location of management server   


# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M


# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin


# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# server_id = .....




# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 


sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 


其它sql节点配置也一样,如果是同一台机端口需要修改不同


启动命令
>cm D:\Program Files\mysqlcluster\sqlnode\mysql\bin

>mysqld --console


                       微笑如果你觉得此文章对你有用,给我点动力,请我喝杯奶茶咯微笑


阅读更多
上一篇MySQL-Cluster架构图文详解
下一篇MySQL存储引擎
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭