环境
- EMQX 版本:开源版本 5.0.9
- 操作系统版本:
Operating System: Amazon Linux 2
CPE OS Name: cpe:2.3amazon:amazon_linux:2
Kernel: Linux 5.10.167-147.601.amzn2.x86_64
Architecture: x86-64
重现此问题的步骤
上图为仪表上面的数据,这里消息丢失的原因是什么,要怎么优化?
下面是对其中一个设备进行一段时间的追踪日志,其中标注的*****中间的日志中的消息丢失(即2023-05-11T10:24:37+00:00 [MQTT] ……),服务端没有收到相关数据
2023-05-11T10:24:23+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0),Topic=lock/cmd/8671****367, PacketId=undefinedPayload=QPARAM,0,23/05/11 10:24:23+2
2023-05-11T10:24:26+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBLISH(Q2, R0, D0),Topic=lock/msg, PacketId=1Payload=8671****367,LPARAM,0,0,180,****,****,10120,0,F,F,F,0,0,1|5|20|15|30,0,0,020103,46000,1,1,1,5,180,1,ÿ
2023-05-11T10:24:26+00:00 [QUERY] lock_8671****367@10.0.0.202:55954 msg: mysql_connector_received, connector: emqx_authz_mysql:10, sql: emqx_authz_mysql, state: [auto_reconnect: true, poolname: emqx_authz_mysql:10:11, prepare_statement: [emqx_authz_mysql: SELECT action, permission, topic FROM mqtt_acl where username = ?]]
2023-05-11T10:24:26+00:00 [PUBLISH] lock_8671****367@10.0.0.202:55954 msg: publish_to, topic: lock/msg, payload: 8671****367,LPARAM,0,0,180,****,****,10120,0,F,F,F,0,0,1|5|20|15|30,0,0,020103,46000,1,1,1,5,180,1,ÿ
2023-05-11T10:24:26+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBREC(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:27+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBREL(Q1, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:27+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBCOMP(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:34+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0),Topic=lock/cmd/8671****367, PacketId=undefinedPayload=QUERY-FUNCTION,0,23/05/11 10:24:34+2
*****
> 2023-05-11T10:24:37+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBLISH(Q2, R0, D0),Topic=lock/msg, PacketId=1Payload=8671****367,FUNCTION-INFO,01,02,01,00,00,120,23/05/11,10:24:35+32
*****
2023-05-11T10:24:37+00:00 [PUBLISH] lock_8671****367@10.0.0.202:55954 msg: publish_to, topic: lock/msg, payload: 8671****367,FUNCTION-INFO,01,02,01,00,00,120,23/05/11,10:24:35+32
2023-05-11T10:24:37+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBREC(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:37+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBREL(Q1, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:37+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBCOMP(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:40+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0),Topic=lock/cmd/8671****367, PacketId=undefinedPayload=QPARAM,0,23/05/11 10:24:40+2
2023-05-11T10:24:43+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBLISH(Q2, R0, D0),Topic=lock/msg, PacketId=1Payload=8671****367,LPARAM,0,0,180,****,****,10120,0,F,F,F,0,0,1|5|20|15|30,0,0,020103,46000,1,1,1,5,180,1,ÿ
2023-05-11T10:24:43+00:00 [PUBLISH] lock_8671****367@10.0.0.202:55954 msg: publish_to, topic: lock/msg, payload: 8671****367,LPARAM,0,0,180,****,****,10120,0,F,F,F,0,0,1|5|20|15|30,0,0,020103,46000,1,1,1,5,180,1,ÿ
2023-05-11T10:24:43+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBREC(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:43+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBREL(Q1, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:43+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBCOMP(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:54+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0),Topic=lock/cmd/8671****367, PacketId=undefinedPayload=QUERY-FUNCTION,0,23/05/11 10:24:54+2
2023-05-11T10:24:56+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBLISH(Q2, R0, D0),Topic=lock/msg, PacketId=1Payload=8671****367,FUNCTION-INFO,01,02,01,00,00,120,23/05/11,10:24:55+32
2023-05-11T10:24:56+00:00 [PUBLISH] lock_8671****367@10.0.0.202:55954 msg: publish_to, topic: lock/msg, payload: 8671****367,FUNCTION-INFO,01,02,01,00,00,120,23/05/11,10:24:55+32
2023-05-11T10:24:56+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBREC(Q0, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:57+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_received, packet: PUBREL(Q1, R0, D0),PacketId=1, ReasonCode=0
2023-05-11T10:24:57+00:00 [MQTT] lock_8671****367@10.0.0.202:55954 msg: mqtt_packet_sent, packet: PUBCOMP(Q0, R0, D0),PacketId=1, ReasonCode=0