日期:2014-05-16 浏览次数:20807 次
下图中画出了三种群集节点及应用程序间的关系:
下载MySQL集群:http://dev.mysql.com/downloads/cluster/
mysql-cluster-gpl-7.3.5-winx64.zip:
http://cdn.mysql.com/Downloads/MySQL-Cluster-7.3/mysql-cluster-gpl-7.3.5-winx64.zip
mysql-cluster-gpl-7.3.5-win32.zip:
http://cdn.mysql.com/Downloads/MySQL-Cluster-7.3/mysql-cluster-gpl-7.3.5-win32.zip
首先找三台电脑,或者是开三个虚拟机,管理节点部署在一台机子上,其他两台每台都部署一个数据节点和一个SQL节点。这里以两台机子举例,其中一台(IP为192.168.24.16)部署管理节点、数据节点和SQL节点,另一台(IP为192.168.24.43)部署数据节点和SQL节点。
实际应用中,不要将管理节点跟数据节点部署到一台机子上,因为如果数据节点宕机会导致管理节点不可用,同时整个MySQL群集也就都不可用了。所以一个MySQL群集理想情况下至少有三台服务器,将管理节点单独放到一台服务器上。这里以两台举例,只是为了说明三种节点的配置启动方法。
[ndbd default] # Options affecting ndbd processes on all data nodes: # Number of replicas NoOfReplicas=2 DataDir=c:/mysqlcluster/datanode/mysql/bin/cluster-data # Directory for each data node's data files # Memory allocated to data storage DataMemory=80M # Memory allocated to index storage IndexMemory=18M # For DataMemory and IndexMemory, we have used the # default values. [ndb_mgmd] # Management process options: # Hostname or IP address of management node HostName=192.168.24.16 # Directory for management node log files DataDir=C:/mysql/bin/cluster-logs [ndbd] # Options for data node "A": # (one [ndbd] section per data node) # Hostname or IP address HostName=192.168.24.16 [ndbd] # Options for data node "B": # Hostname or IP address HostName=192.168.24.43 [mysqld] # SQL node options: # Hostname or IP address HostName=192.168.24.16 [mysqld] # SQL node options: # Hostname or IP address HostName=192.168.24.43
3、my.ini中的内容如下: