从日志看,要么是多个设备使用了相同的clientid,要么是一个设备自己重新发起连接。
grep -e “term|CON” emqx@trace_dr154_2023-10-08.log
2023-10-08T15:32:58.333275+08:00 [MQTT] 00501923551700018760@46.103.19.207:52129 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=00501923551700018760, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=admin, Password=)
2023-10-08T15:32:58.451454+08:00 [SOCKET] 00501923551700018760@46.103.19.207:52128 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-10-08T15:32:58.452022+08:00 [MQTT] 00501923551700018760@46.103.19.207:52129 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-10-08T15:34:33.390408+08:00 [MQTT] 00501923551700018760@46.103.19.207:52130 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=00501923551700018760, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=admin, Password=)
2023-10-08T15:34:33.476516+08:00 [SOCKET] 00501923551700018760@46.103.19.207:52129 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-10-08T15:34:33.477682+08:00 [MQTT] 00501923551700018760@46.103.19.207:52130 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-10-08T15:49:08.883950+08:00 [MQTT] 00501923551700018760@46.103.19.207:52131 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=00501923551700018760, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=admin, Password=******)
2023-10-08T15:49:08.964333+08:00 [SOCKET] 00501923551700018760@46.103.19.207:52130 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-10-08T15:49:08.965040+08:00 [MQTT] 00501923551700018760@46.103.19.207:52131 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
-
ClientId=00501923551700018760发起连接请求
2023-10-08T15:32:58.333275+08:00 [MQTT] 00501923551700018760@46.103.19.207:52129 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=00501923551700018760, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=admin, Password=******)
-
因为这个连接请求的clientid与“00501923551700018760@46.103.19.207:52128”的一样,所以这个连接“00501923551700018760@46.103.19.207:52128“就断开了。
2023-10-08T15:32:58.451454+08:00 [SOCKET] 00501923551700018760@46.103.19.207:52128 msg: emqx_connection_terminated, reason: {shutdown,takenover}
-
00501923551700018760@46.103.19.207:52129连接成功。
2023-10-08T15:32:58.452022+08:00 [MQTT] 00501923551700018760@46.103.19.207:52129 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
-
后面又来了相同clientid的请求,然后step 3中的连接就断开了。