端口在同一网络上不可用(MySQL 与 docker)

端口在同一网络上不可用(MySQL 与 docker)

我在一个网络中有两台服务器。

  1. 192.168.202.5 网络掩码 255.255.255.0
  2. 192.168.202.32 网络掩码 255.255.255.0

在第二台服务器上我开始MySQL使用Docker Compose.

docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                   PORTS                                                   NAMES
dec33e6c66fe        mysql/mysql-cluster   "/entrypoint.sh mysq…"   2 hours ago         Up 2 hours (healthy)     1186/tcp, 2202/tcp, 33060/tcp, 0.0.0.0:3306->3306/tcp   ndb_ndb_mysqld_1
56ccfd399288        mysql/mysql-cluster   "/entrypoint.sh ndbd"    2 hours ago         Up 2 hours (unhealthy)   1186/tcp, 2202/tcp, 3306/tcp, 33060/tcp                 ndb_ndb_data_node_1_1
1f6a2f2db72c        mysql/mysql-cluster   "/entrypoint.sh ndb_…"   2 hours ago         Up 2 hours (unhealthy)   2202/tcp, 3306/tcp, 0.0.0.0:1186->1186/tcp, 33060/tcp   ndb_ndb_mgmd_1

netstat -nta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 192.168.202.32:22       10.40.20.156:34458      ESTABLISHED
tcp        0     36 192.168.202.32:22       10.40.20.156:35210      ESTABLISHED
tcp6       0      0 :::3306                 :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::1186                 :::*                    LISTEN

端口 3306 打开。在第二台服务器(192.168.202.32)上我尝试:

telnet 192.168.202.32 3306
Trying 192.168.202.32...
Connected to 192.168.202.32.
Escape character is '^]'.
`
5.7.25-ndb-7.6.9-cluster-gpl

访问是并且一切都可用。

但是当我尝试从第一台服务器(从 192.168.202.5)执行相同操作时,我收到连接超时:

telnet 192.168.202.32 3306
Trying 192.168.202.32...
telnet: connect to address 192.168.202.32: Connection timed out
[oracle@host-192-168-202-5 ~]$ 

但同时在端口 22 上我可以连接。我尝试禁用Iptables,但没有帮助。我不明白为什么会发生这种情况以及在哪里寻找更多信息?

我用OracleLinux7

uname -a
Linux host-192-168-202-5 3.8.13-118.6.1.el7uek.x86_64

相关内容