【发布时间】:2017-04-10 00:53:25
【问题描述】:
我的 MySQL 集群在 AWS EC2 实例(3 个数据节点和 1 个管理节点,在运行 Ubuntu 最新版本的 t2.micro)上运行时遇到问题。我遵循了本教程(使用 MySQL Cluster 7.5.5 的更新版本):https://stansantiago.wordpress.com/2012/01/04/installing-mysql-cluster-on-ec2/
在my.cnf 文件中,我有以下代码:
[mysqld]
ndbcluster
datadir=/opt/mysqlcluster/deploy/mysqld_data
basedir=/opt/mysqlcluster/home/mysqlc
port=3306
在config.ini 文件中,我有这个代码:
[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
然后我像这样启动管理节点:
ndb_mgmd -f /opt/mysqlcluster/deploy/conf/config.ini --initial --configdir=/opt/mysqlcluster/deploy/conf
一切正常,我没有显示错误。
但是,当我尝试将一个从属设备连接到集群时,使用以下命令:
ndbd -c <private DNS of master>:1186
此错误代码失败:
Unable to connect with connect string: nodeid=0,<private DNS of master>:1186
我尝试了命令ndb_mgm -e show 看看发生了什么:
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)
似乎管理节点在localhost上启动,这就是它失败的原因吗? 我不明白为什么我无法将数据节点连接到集群,因为配置文件看起来不错。
如果有人有任何建议,将不胜感激。谢谢!
【问题讨论】:
标签: mysql amazon-web-services amazon-ec2 mysql-cluster