I have a problem with my MySQL Cluster running on AWS EC2 instances (3 data nodes and 1 management node, on t2.micro running Ubuntu latest version). I followed this tutorial (with updated version of MySQL Cluster 7.5.5) : https://stansantiago.wordpress.com/2012/01/04/installing-mysql-cluster-on-ec2/
In my.cnf
file, I have the following code :
[mysqld]
ndbcluster
datadir=/opt/mysqlcluster/deploy/mysqld_data
basedir=/opt/mysqlcluster/home/mysqlc
port=3306
In config.ini
file, I have this code :
[ndb_mgmd]
hostname=<private DNS of master>
datadir=/opt/mysqlcluster/deploy/ndb_data
nodeid=1
[ndbd default]
noofreplicas=3
datadir=/opt/mysqlcluster/deploy/ndb_data
[ndbd]
hostname=<private DNS of slave 1>
nodeid=3
[ndbd]
hostname=<private DNS of slave 2>
nodeid=4
[ndbd]
hostname=<private DNS of slave 3>
nodeid=5
[mysqld]
nodeid=50
Then I start the management node like this :
ndb_mgmd -f /opt/mysqlcluster/deploy/conf/config.ini --initial --configdir=/opt/mysqlcluster/deploy/conf
Everything seems fine, I have no error displayed.
However, when I try to connect a slave to the cluster, with this command :
ndbd -c <private DNS of master>:1186
it fails with this error code :
Unable to connect with connect string: nodeid=0,<private DNS of master>:1186
I tried the command ndb_mgm -e show
to see what was going on :
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 3 node(s)
id=3 (not connected, accepting connect from <private DNS of slave 1>)
id=4 (not connected, accepting connect from <private DNS of slave 2>)
id=5 (not connected, accepting connect from <private DNS of slave 2>)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @<private IP address of master> (mysql-5.7.17 ndb-7.5.5)
[mysqld(API)] 1 node(s)
id=50 (not connected, accepting connect from any host)
It seems that the management node started on localhost, is this why it fails ? I don't understand why I can't connect the data nodes to the cluster because the configuration files look good.
If somebody has any suggestion, it would be much appreciated. Thank you !
答案 0 :(得分:1)
让MySQL Cluster在EC2上运行的问题是确保这一点 所有虚拟机都可以通过适当的端口进行通信。
这是通过添加所有VM所属的安全组来处理的。 我创建了一个名为NDB Cluster的安全组,它有规则 要在以下端口上进行通信的入站和出站TCP流量: 1186(NDB管理服务器端口),3306(MySQL服务器端口),3316(额外的MySQL服务器端口),8081(MySQL集群自动安装程序端口),11860(MySQL集群数据节点端口),33060(MySQLX端口)。
我在config.ini中添加了一行到NDBD DEFAULT部分 ServerPort = 11860 这意味着所有节点都使用此连接到数据节点 端口号。
所有使用此安全组的虚拟机都像魅力一样 当没有设置为在所有节点之间进行通信时,事情并不起作用 显然非常好。