I am testing MySQL Cluster 7.2. I have two servers, mysql1
and mysql2
. I want the management server and two data nodes to run on mysql1
and two other data nodes to run on mysql2
. My config.ini
file looks like this:
[ndb_mgmd]
hostname=mysql1
datadir=/var/mysql-cluster/ndb_data
NodeId=1
[ndbd default]
noofreplicas=2
datadir=/var/mysql-cluster/ndb_data
DataMemory=8M
[ndbd]
hostname=mysql1
NodeId=3
[ndbd]
hostname=mysql2
NodeId=4
[ndbd]
hostname=mysql1
NodeId=13
[ndbd]
hostname=mysql2
NodeId=14
[mysqld]
NodeId=50
With this configuration I would expect, as per the MySQL Cluster documentation, that the two data nodes 3 and 4 would be in nodegroup 0, while the two data nodes 13 and 14 would be in nodegroup 1.
However, when I start everything up and show the nodes, I see this:
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 4 node(s)
id=3 @192.168.0.42 (mysql-5.5.30 ndb-7.2.12, starting, Nodegroup: 0, Master)
id=4 @192.168.0.43 (mysql-5.5.30 ndb-7.2.12, starting, Nodegroup: 0)
id=13 @192.168.0.42 (mysql-5.5.30 ndb-7.2.12, starting, Nodegroup: 0)
id=14 @192.168.0.43 (mysql-5.5.30 ndb-7.2.12, starting, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.42 (mysql-5.5.30 ndb-7.2.12)
[mysqld(API)] 1 node(s)
id=50 (not connected, accepting connect from any host)
Everything seems to be in nodegroup 0! What do I have to do to get 3 and 4 in one group and 13 and 14 in another?
-
I'm having the same question. I asked it here. stackoverflow.com/questions/19094959/… And I started a bounty on your question as it seems a common problem.Bee– Bee2013年12月29日 20:28:36 +00:00Commented Dec 29, 2013 at 20:28
3 Answers 3
This seems to be a bug [1] in MySQL. It happens because your data nodes are still starting. Node-group IDs should be shown correctly once they are started completely.
-
That bug is 7 years old, I'd be surprised if it wasn't already fixed.shearn89– shearn892015年03月24日 10:40:09 +00:00Commented Mar 24, 2015 at 10:40
Put "NodeGroup" value in each data node and it will solve it .
For more information read : https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-nodes-groups.html
Start them one by one, this way it will connect two data nodes to each SQL Node.(bearing in mind you will have to clear cache file which gets generated in mysql-cluster/
folder) and ps aux | grep ndb
or ps aux | grep sql
exit them all before trying it out.
Your config file looks to be pointing only to 1x SQL node.
Change it to:
[ndb_mgmd]
hostname=mgm.yourname
datadir=/var/mysql-cluster/ndb_data
NodeId=1
[ndbd default]
noofreplicas=4
datadir=/var/mysql-cluster/ndb_data
DataMemory=8M
[ndbd]
hostname=ndb1.forsql1
NodeId=3
[ndbd]
hostname=ndb2.forsql1
NodeId=4
[ndbd]
hostname=ndb3.forsql2
NodeId=13
[ndbd]
hostname=ndb4.forsql2
NodeId=14
[mysqld]
NodeId=50
[mysqld]
NodeId=51
Enter ndbd
on ndb1.forsql1 Data node,
Enter ndbd
on ndb2.forsql1 Data node,
Enter sqld
on 1st SQL node,
Enter ndbd
on ndb3.forsql2 Data node,
Enter ndbd
on ndb4.forsql2 Data node,
Enter sqld
on 2nd SQL node.
Wait and be patient till it connects and shows automatically on ndb_mgm> console that node x: has been started only then proceed. Another way to check is to find by typing all report memory
and check if it has replicated the data only then proceed if it has.