config file and parameters for ndb_desc
-
17-01-2021 - |
質問
I'm trying to execute ndb_desc
from API client. The config and parameters are as below:
my.cnf in mysqld:
[mysql_cluster]
ndb-connectstring=192.168.1.1,192.168.1.2
server-id=5
log-bin=mysql-bin
config.ini in mgmd: (part of it)
-- ...
[mysqld]
hostname=192.168.1.5
--- ...
Situation: there are 2x mgmd, 2x data-node, and 2x mysqld.
Parameters tried to call ndb_desc: # ndb_desc -c 192.168.1.1 --ndb-nodeid=7 -d db_name -t tb_name
Above response with error: ndb_desc: [ERROR] unknown variable 'server-id=5
On changing my.cnf
, removing these two lines of server-id
and log-bin
, then the error response after calling ndb_desc will be as follow:
Unable to connect to management server.
NDBT_ProgramExit: 1 - Failed
There is no firewall, ping to the management is running fine.
So the question: how to exec ndb_desc (with correct parameters)? what is the correct my.cnf/config.ini for setting up the node-id?
Some links i have tried to check before posting this: mysql-cluster-work-well-but-ndb-desc-doesnt-work, mysql:ndb_desc, mysql:connection-string, grokbase, and several hours of googling around.
update1: changed the config.ini on mgmd for emtpy mysqld section, ndb_mgm -e show
output:
[mysqld(API)] 3 node(s)
id=5 @192.168.1.5 (mysql-5.7.23 ndb-7.6.7)
id=6 @192.168.1.6 (mysql-5.7.23 ndb-7.6.7)
id=7 (not connected, accepting connect from any host)
ndb_desc still has the same response: Unable to connect to management server.
update2: from mgmd node, saw this log: WARNING -- Failed to allocate nodeid for API at 192.168.1.5. Returned error: 'Id 7 already allocated by another node.
update3: changed config.ini, added [api] nodeid=7 host=192.168.1.5
. log still the same: WARNING -- Failed to allocate nodeid for API at 192.168.11.51. Returned error: 'No free node id found for mysqld(API).
解決
Here are the changes i made to make this work:
- add empty api node at the end of mgmd config.ini:
[api]
- stop both of ndbd from mgmd:
ndb_mgm -e "3 stop" | "4 stop"
- stop both of mgmd:
ndb_mgm -e "1 stop" | "2 stop"
- start mgmd 1:
ndb_mgmd --initial --reload --config-file=/var/lib/mysql-cluster/config.ini
- start mgmd 2:
ndb_mgmd --initial --config-file=/var/lib/mysql-cluster/config.ini
- start ndbd manually: ssh to the machine and run
ndbd
- wait until all node connected
- make sure my.cnf at mysql node is having:
[mysql_cluster] ndb-connectstring=192.168.1.1,192.168.1.2
, or can add-c
on ndb_desc param later - run ndb_desc at mysql node:
ndb_desc -p -d db_name -t tb_name
the important missing part after adding empty api node is restarting the data node
link to source: No free node id found