Search code examples
mysqlmysql-cluster

Failed to allocate nodeid for API at <sql_node_ipaddr>. Returned error: 'No free node id found for mysqld(API).'


OS and mysql cluster version

  • OS: Linux centos7
  • mysql cluster: mysql-cluster-community-7.5.8-1.el7.x86_64

Server list

  • 192.168.1.101 ndbd node1
  • 192.168.1.102 ndbd node2
  • 192.168.1.103 ndb_mgmd
  • 192.168.1.104 mysql(api) node1
  • 192.168.1.105 mysql(api) node2

The two data node(ndbd) is OK,but sql node(mysql) cannot connect to ndb_mgmd.The network is OK. SElinux and firewall is disabled.

My config

mgmd config(/var/lib/mysql-cluster/config.ini)

[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
ServerPort=2202

[ndb_mgmd]
HostName=192.168.1.103
DataDir=/var/lib/mysql-cluster

[ndbd]
HostName=192.168.1.101
NodeId=2
DataDir=/opt/mysql/data

[ndbd]
HostName=192.168.1.102
NodeId=3
DataDir=/opt/mysql/data

[mysqld]
HostName=192.168.1.104

mysql config(/etc/config.ini)

[mysqld]
user=mysql
ndbcluster
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

symbolic-links=0
default-storage-engine=NDBCLUSTER
ndb-connectstring=192.168.1.103

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql_cluster]
ndb-connectstring=192.168.1.103

Error log

mgmd log

2017-11-27 20:28:35 [MgmtSrvr] WARNING  -- Failed to allocate nodeid for API at 192.168.1.104. Returned error: 'No free node id found for mysqld(API).'
2017-11-27 20:28:36 [MgmtSrvr] INFO     -- Alloc node id 4 failed, no new president yet

sql node log(mysqld)

2017-11-28T03:18:43.565265Z 4 [Warning] NDB: Failed to acquire global schema lock, error: (4009)Cluster Failure
2017-11-28T03:18:43.566664Z 4 [Warning] NDB: Failed to acquire global schema lock, error: (4009)Cluster Failure

Solution

  • 1) You started the management server fromt he wrong node, it is started from 192.168.1.104, but in config it says it should be in 192.168.1.103.

    2) You are missing a mysqld section for the second MySQL server at 192.168.1.105

    Some recommendations: 1) Assign node ids to all nodes 2) Add an API node as well to enable running some NDB tools as well