我已经设置了一个包含 7 个节点的 ndb 集群。3 个数据节点位于各自的服务器上,2 个管理节点在 2 台服务器上各有一个 sql 节点。我已经缩小了我认为我的问题的范围。我的集群似乎无法选举总统数据节点,但我不知道如何设置选举规则。任何人都可以帮助我进行设置吗?是我的配置错误吗?谢谢。以下是所有详细信息。
这是我的管理节点配置:
[ndbd default]
NoOfReplicas=3
#DataMemory=2048M
#IndexMemory=512M
#Management Nodes
[ndb_mgmd]
hostname=192.168.0.1
NodeId=1
datadir=/var/lib/mysql-cluster
[ndb_mgmd]
hostname=192.168.0.2
NodeId=2
datadir=/var/lib/mysql-cluster
#Data Nodes
[ndbd]
hostname=192.168.0.3
NodeId=3
datadir=/usr/local/mysql/data
[ndbd]
hostname=192.168.0.4
NodeId=4
datadir=/usr/local/mysql/data
[ndbd]
hostname=192.168.0.5
NodeId=5
datadir=/usr/local/mysql/data
#front end servers
[mysqld]
hostname=192.168.0.1
#NodeId=11
[mysqld]
hostname=192.168.0.2
#NodeId=22
这是我的 sql 节点配置 - my.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
ndbcluster
[mysql_cluster]
ndb-connectstring=192.168.0.1,192.168.0.2
这是数据节点连接字符串
[mysql_cluster]
# Options for NDB Cluster processes:
ndb-connectstring=192.168.0.1,192.168.0.2
这就是 ndb_mgm> show 所说的
id=3 @192.168.0.3 (mysql-8.3.0 ndb-8.3.0, starting, Nodegroup: 0)
id=4 @192.168.0.4 (mysql-8.3.0 ndb-8.3.0, starting, Nodegroup: 0)
id=5 @192.168.0.5 (mysql-8.3.0 ndb-8.3.0, starting, Nodegroup: 0)
[ndb_mgmd(MGM)] 2 node(s)
id=1 @192.168.0.1 (mysql-8.3.0 ndb-8.3.0)
id=2 @192.168.0.2 (mysql-8.3.0 ndb-8.3.0)
[mysqld(API)] 2 node(s)
id=6 (not connected, accepting connect from 192.168.0.1)
id=7 (not connected, accepting connect from 192.168.0.2)
节点 3,4, & 5 陷入状态
ndb_mgm> 3 status
Node 3: starting (Last completed phase 0) (mysql-8.3.0 ndb-8.3.0)
ndb_mgm> 4 status
Node 4: starting (Last completed phase 0) (mysql-8.3.0 ndb-8.3.0)
ndb_mgm> 5 status
Node 5: starting (Last completed phase 0) (mysql-8.3.0 ndb-8.3.0)
SQL 节点 6 (11) 和 7 (22) 将无法连接。
SQL 和数据节点的错误日志中没有任何内容。管理节点的集群日志每分钟重复一次:
TIME [MgmtSrvr] INFO -- Alloc node id 6 rejected, no new president yet
TIME [MgmtSrvr] WARNING -- Unable to allocate nodeid for API at 192.168.0.1. Returned error: 'Cluster not ready for nodeid allocation.'
TIME [MgmtSrvr] INFO -- Node 3: Initial start, waiting for 4 and 5 to connect, nodes [ all: 3, 4 and 5 connected: 3 no-wait: ]
TIME [MgmtSrvr] INFO -- Node 5: Initial start, waiting for 3 and 4 to connect, nodes [ all: 3, 4 and 5 connected: 5 no-wait: ]
TIME [MgmtSrvr] INFO -- Node 4: Initial start, waiting for 3 and 5 to connect, nodes [ all: 3, 4 and 5 connected: 4 no-wait: ]