mysql 7 (cluster) 集群 配置

注意:在启动数据节点后会预分配2G的硬盘空间(preallocate the space for the logs (used for recovery). This is to avoid problems during running of waiting for the OS to allocate disk space or running out of space),在分配成功后再启动服务节点!

 

配置过程:http://www.cnblogs.com/jinzhenshui/archive/2009/12/18/1627364.html

#

管理节点配置文件my_cluster.ini

[NDBD DEFAULT]
NoOfReplicas=2         # 默认值是2.
DataDir= E:\Program Files\MySQL\MySQL Server 7.0\Data\user_data     #如果不存在就创建一个

# Managment Server
[NDB_MGMD]
nodeid=40
HostName=192.168.1.102 #管理节点服务器db1的IP地址
# Storage Engines   
[NDBD]
nodeid=11
HostName=192.168.1.102 #MySQL集群db1的IP地址
[NDBD]
nodeid=12
HostName=192.168.1.102 #MySQL集群db2的IP地址
[MYSQLD]
nodeid=1
HostName=192.168.1.102
[MYSQLD]
nodeid=2
HostName=192.168.1.102
[MYSQLD]
nodeid=3
HostName=192.168.1.102

------------------------------------------

每个的mysql配置文件(指定端口与datadir):
[mysqld]
basedir="e:/Program Files/MySQL/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="e:/Program Files/MySQL/MySQL Server 7.0/data/user_data/node1/"
general_log_file="e:/Program Files/MySQL/MySQL Server 7.0/data/user_data/node1/general_log.log"
#
ndbcluster
ndb_connectstring="192.168.1.102"
#
skip_innodb
#
[ndbd]
ndb_connectstring="192.168.1.102"

------------------------------------------

将mysql数据库复制到datadir下

 

 

运行:

管理节点(mgmd)bat:

"E:\Program Files\MySQL\MySQL Server 7.0\bin\ndb_mgmd.exe" --config-file="E:/Program Files/MySQL/MySQL Server 7.0/data/mysql_cfg/my_cluster.ini" --initial
pause

image

数据节点(ndbd):

"e:\Program Files\MySQL\MySQL Server 7.0\bin\ndbd.exe" --defaults-file="e:\Program Files\MySQL\MySQL Server 7.0\data\user_data\node1\my_node1.ini"

image

(ndb_mgm.exe )show:

image

服务节点(mysqld):

"e:\Program Files\MySQL\MySQL Server 7.0\bin\mysqld.exe" --defaults-file="e:\Program Files\MySQL\MySQL Server 7.0\data\user_data\node1\my_node1.ini" --console
pause

image

show:

image

你可能感兴趣的:(cluster)