管理节点

管理节点

我已经在 centos 7 中配置了 mysql-cluster

管理节点

  • db1 = 192.168.5.130

数据节点

  • db2 = 192.168.5.131
  • db3 = 192.168.5.132

SQL 节点

  • db4 = 192.168.5.133
  • db5 = 192.168.5.134

管理节点的输出如下..

ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2    @192.168.5.131  (mysql-5.6.28 ndb-7.4.10, starting, Nodegroup: 0)
id=3    @192.168.5.132  (mysql-5.6.28 ndb-7.4.10, starting, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.5.135  (mysql-5.6.28 ndb-7.4.10)

[mysqld(API)]   2 node(s)
id=4 (not connected, accepting connect from 192.168.5.133)
id=5 (not connected, accepting connect from 192.168.5.134)

数据节点已成功连接到管理节点,但 SQL 节点未连接

我看到了一些错误ndb_1_集群.log文件。

WARNING  -- Failed to allocate nodeid for API at 192.168.5.134. Returned error: 'No free node id found for mysqld(API).'

如何解决这个问题?请指导我配置 mysql-cluster

答案1

检查你的config.ini/var/lib/mysql-cluster/看起来应该是这样的,如果你使用超过 2 个数据节点,应该附加节点 ID。最重要的是确保你尝试运行的数据节点已经mysql.service运行。systemctl mysql.service status

[ndb_mgmd]
# Management process options:
hostname=10.10.12.184           # Hostname of the manager
datadir=/var/lib/mysql-cluster  # Directory for the log files

[ndbd]
hostname=10.10.12.186           # Hostname of the 1st data node
nodeid=1;                       # Node id 1
datadir=/usr/local/mysql/data   # Remote directory for the data files

[ndbd]
hostname=10.10.12.187           # Hostname of the 2nd data node
nodeid=2;                       # Node id 2
datadir=/usr/local/mysql/data   # Remote directory for the data files

[ndbd]
hostname=10.10.12.188           # Hostname of the 3rd data node
nodeid=3;                       # Node id 3
datadir=/usr/local/mysql/data   # Remote directory for the data files

[ndbd]
hostname=10.10.12.189           # Hostname of the 4th data node
nodeid=4;                       # Node id 4
datadir=/usr/local/mysql/data   # Remote directory for the data files

[mysqld]
# SQL node options:
hostname=10.10.12.184  # In our case the MySQL server/client is on the same Droplet as$

根据我的经验,您应该先运行所有 ndbd 节点,然后再逐个运行 sqld 节点。

相关内容