8084端口连不上的问题

8084端口连不上的问题

环境信息

  • EMQX 版本: EMQ X Broker 4.3.2

  • 操作系统及版本:

  • [root@xxx emqx]# cat /proc/version

  • Linux version 4.18.0-240.22.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021

  • [root@xxx emqx]# cat /etc/redhat-release

  • CentOS Linux release 8.3.2011

  • 其他

问题描述

小程序连接8084连不上了,之前都正常,但是前几天有一次,还有今天有一次,小程序连接8084连不上了,其他端口都是好的 1883,8083。 虽然 emqx stop,然后 emqx start 可以解决问题,但是因为出现了两次,而且相隔的天数不多。不过可能考虑是我们这边代码写的有问题?但是目前没有想法,服务器内存,cpu应该都是够的

配置文件及日志

log 请看链接
https://acc15t4bm5.feishu.cn/docs/doccn81fAJwlH4CPh28ZiEnQ8Wb

这是我之前重启emqx的log,我在重启之前查看了8084端口,发现服务是在跑的
java.io.EOFException
[root@xxx newfit]# lsof -i:8084
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 782595 emqx 43u IPv4 360327875 0t0 TCP *:8084 (LISTEN)
beam.smp 782595 emqx 45u IPv4 360329324 0t0 TCP xxx:8084->202.107.195.201:speedtrace (ESTABLISHED)
beam.smp 782595 emqx 46u IPv4 360329572 0t0 TCP xxx:8084->202.107.195.201:25886 (ESTABLISHED)
[root@xxx newfit]# emqx stop
ok
[root@xxx newfit]# lsof -i:8084
[root@xxx newfit]# emqx start
EMQ X Broker 4.3.2 is started successfully!
[root@xxx newfit]# lsof -i:8084
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 790497 emqx 43u IPv4 360370858 0t0 TCP *:8084 (LISTEN)
beam.smp 790497 emqx 44u IPv4 360394709 0t0 TCP xxx:8084->202.107.195.201:bv-smcsrv (ESTABLISHED)
beam.smp 790497 emqx 45u IPv4 360372071 0t0 TCP xxx:8084->202.107.195.201:45163 (ESTABLISHED)

你的 8084 端口有监听,所以你需要排查下你的入和出方向的链路是否都正常,比如防火墙 NAT规则之类的

[root@ ~]# iptables -t nat -vnL PREROUTING --line-number
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
[root@ ~]# iptables -t nat -vnL OUTPUT --line-number
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination

[root@ ~]# firewall-cmd --state
not running

这边看不出nat、防火墙有什么配置,阿里云服务器8084也是开的,因为我是重启emqx可以解决,但是我看log也看不出问题在哪

从外部和内部分别 telnet 8084 看看,然后你的 8084 运行的是什么服务

[root@xxx ~]# telnet localhost 8084

Trying ::1…

telnet: connect to address ::1: Connection refused

Trying 127.0.0.1…

Connected to localhost.

Escape character is ‘^]’.

Connection closed by foreign host.

telnet 116.62.172.159 8084

[root@iZuf61itscfjc6o9pu5l8hZ ~]# telnet 116.62.172.159 8084

Trying 116.62.172.159…

Connected to 116.62.172.159.

Escape character is ‘^]’.

Connection closed by foreign host.

请问我是不是应该在他不正常的时候做这些操作,因为昨天我重启之后现在应该是正常的,不正常的的情况并不多,只是近几天出现了两次,以前都没有的

[root@xxx ~]# netstat -tunlp |grep 8084
tcp 0 0 0.0.0.0:8084 0.0.0.0:* LISTEN 790497/emqx

想起来了 上次失效的时候 是telnet过的,当时就是8084 telnet不上
[root@ newfit]# lsof -i:8084
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 3267589 emqx 33u IPv4 166566712 0t0 TCP *:8084 (LISTEN)
这里有的 telnet 不行 local host 也不行

[root@ newfit]# telnet localhost 8083
Trying ::1…
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
Connection closed by foreign host.
[root@ newfit]#
[root@ newfit]#
[root@ newfit]# telnet localhost 8084
Trying ::1…
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1…
q

q^C

你是有多个网卡,然后监听只在某个网卡上?如果不是,那多半是你的网络链接问题了,你可以联系下云服务提供商一起协查下

好的 谢谢

救命,今天我的8084又不行了
这个是我从别的主机telnet服务器的8084
[root@VM-12-3-centos ~]# telnet zzzzzz.com 8084
Trying 111.11.172.159…
Connected to zzzzz.com.
Escape character is ‘^]’.

Starting emqx on node emqx@127.0.0.1
Start http:management listener on 8081 successfully.
Start http:dashboard listener on 18083 successfully.
Start mqtt:tcp:internal listener on 127.0.0.1:11883 successfully.
Start mqtt:tcp:external listener on 0.0.0.0:1883 successfully.
Start mqtt:ws:external listener on 0.0.0.0:8083 successfully.
Start mqtt:ssl:external listener on 0.0.0.0:8883 successfully.
Start mqtt:wss:external listener on 0.0.0.0:8084 successfully.
EMQ X Broker 4.3.2 is running now!
Eshell V11.1.8 (abort with ^G)

连接 8084 需要证书吗

连接 8084 需要证书吗

知道了 是证书过期了
cat /etc/emqx/emqx.conf |grep listener.wss.external.keyfile
EMQX SSL/TLS 使用配置指南 | EMQ