[英]Can't connect to MariaDB
因此,我有两台有问题的AWS服务器,一台正在运行MariaDB,另一台是我的API服务器(基于python)。 我可以在MariaDB服务器和我的开发计算机上本地正常连接。 我无法通过API服务器或第三个AWS服务器进行连接。
netstat输出
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:mysql *:* LISTEN 1363/mysqld
API服务器上的ngrep显示
interface: eth0 (10.[api ip]/255.255.255.0)
filter: (ip or ip6) and ( port 3306 )
##########
Maria Server上的ngrep
interface: eth0 ([maria ip]/255.255.255.0)
filter: (ip or ip6) and ( port 3306 )
####
T [maria ip]:3306 -> [dev ip]:2392 [AP]
[redacted]
##
T [dev ip]:2392 -> [maria ip]:3306 [AP]
[redacted]
##
T [maria ip]:3306 -> [dev ip]:2392 [AP]
[redacted]
#######################
最终我得到这个错误
ERROR 2003 (HY000): Can't connect to MySQL server on '[maria ip]' (110 "Connection timed out")
或者从我的python脚本
Exception happened during processing of request from ('127.0.0.1', 50110)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
在有人提到它之前,我的IP表已正确设置,并且AWS SecGrps也不是问题。
这与尝试连接到远程MySQL主机(错误2003)不是重复的,因为(1)服务器之间没有(逻辑)设备,(2)我可以从该国另一侧的Dev站进行连接, (3)这些“修复”均无效。
另外,我可以从API脚本连接到在我的maria服务器上运行的Redis Server。
我认为您必须按照以下步骤操作:
参考@ http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.