在使用 AWS 配置和尝试运行 4 节点/4 主机 MySQL 集群时,我在尝试向管理器注册第一个数据节点时遇到了障碍。
数据节点 (DN) 的公共 IP 与其 eth0 关联的 IP(我将其称为私有 IP)不同,这似乎是一个问题。因此,集群管理器似乎从 DN 接收到 NodeID:11 的传入请求,但源 IP 地址与 config.ini 中指定的 IP 不匹配。
这是我在尝试连接时在 DN 上遇到的错误:
2014-02-08 22:12:45 [ndbd] INFO -- Angel connected to '<mg_public_ip>:1186'
2014-02-08 22:12:48 [ndbd] INFO -- Angel allocated nodeid: 11
2014-02-08 22:12:49 [ndbd] ERROR -- Could not fetch configuration/invalid configuration, error: 'The hostname this node should have according to the configuration does not match a local interface. Attempt to bind '<dn_public_ip>' failed with error: 99 'Cannot assign requested address''
强调“根据配置,此节点应具有的主机名与本地接口不匹配”
我花了 2 天时间在线寻找解决方案!luck。一位遇到此问题的发帖人建议创建一个网络别名,并将eth0 : 0设置为 DN 的公共 IP。这会产生以下日志:(此解决方案还需要配置路由器的 NAT)。
Unable to connect with connect string: nodeid=11,<mg_public_ip>:1186
我相信这是一个网络配置问题,MySQL和AWS可能会提供解决方法,但我还没有找到。任何见解将不胜感激!
细节:
DN Public IP == <dn_public_ip>
DN Private IP == <dn_private_ip>
管理器(MG)也有公私IP:
Manager Public IP == <mg_public_ip>
Manager Private IP == <mg_private_ip>
管理器配置有以下config.ini:
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[tcp default]
# TCP/IP options:
# portnumber=2202 # This the default; however, you can use any
# port that is free for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead
[ndb_mgmd]
# Management process options:
hostname = <mg_private_ip> # Private IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files
[ndbd]
# Options for data node "A":
hostname=<dn_public_ip> # Public address of data node A
datadir=/usr/local/mysql/data # Directory for this data node's data files
NodeId=11
[ndbd]
# Options for data node "B":
hostname=*** # Hostname or IP address
datadir=/usr/local/mysql/data # Directory for this data node's data files
NodeId=12
[mysqld]
# SQL node options:
hostname=**** # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)
NodeId=21
数据节点 A 上的 ifconfig:
eth0 Link encap:Ethernet HWaddr 22:00:0A:FE:87:82
inet <addr:dn_private_ip> Bcast:*.*.*.* Mask:255.255.255.192
inet6 addr: ***** Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9321 errors:0 dropped:0 overruns:0 frame:0
TX packets:7950 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:739918 (722.5 KiB) TX bytes:1194550 (1.1 MiB)
Interrupt:25
_ndb_1_cluster.log 管理器:_
[MgmtSrvr] WARNING -- Found timedout nodeid reservation for 11, releasing it
[MgmtSrvr] INFO -- Nodeid 11 allocated for NDB at <dn_public_ip>