# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[tcp default]
# This the default; however, you can use any
# port that is free for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
[ndb_mgmd]
hostname=192.168.1.110 # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
NodeId=1
[ndbd]
hostname=192.168.1.111 # Hostname or IP address
datadir=/u01/app/mysql/data # Directory for this data node's data files
NodeId=2
[ndbd]
hostname=192.168.1.112 # Hostname or IP address
datadir=/u01/app/mysql/data # Directory for this data node's data files
NodeId=3
[mysqld]
hostname=192.168.1.111 # Hostname or IP address
NodeId=4 # (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
[mysqld]
hostname=192.168.1.112 # Hostname or IP address
NodeId=5 # (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
配置说明:
[ndbd default] 这部分是公共部分,对于每一个数据节点都有效,只需要配置一份
NoOfReplicas=1 数据镜像几份(各数据节点之间相互备份)
[tcp default] 针对每个数据节点及管理节点之间使用哪个端口进行通讯,
在旧版本的NDB集群软件配置时,这个地方通常配置portnumber=2202
但新版的NDB软件这里不需要配置,并且MySQL官方也强烈建议不要配置
[ndb_mgmd] 管理节点的配置部分(通常只有一个)
注意NodeId=1指明管理节点的节点ID为1,如果不指定,在启动集群时,会报错
hostname=192.168.1.110 指明管理节点的IP地址
datadir=/var/lib/mysql-cluster 指明集群管理日志存放的位置
[ndbd] 数据节点配置部分,有几个数据节点就配置几个[ndbd]
hostname=192.168.1.111 指明数据节点的IP地址
datadir=/u01/app/mysql/data 指明数据节点上的数据库文件存放的位置
NodeId=2 指明该数据节点在整个集群中的nodeid号(很重要)
[mysqld] SQL节点配置部分,有几个SQL节点,就配置几个[mysqld]