MQTTX连接EMQX开源版v5.8.2集群,会收到 disconnect的指令,这是啥情况?

|emqx@172.26.0.6|运行中|14 小时 59 分 50 秒|5.8.2|1|585|1.28G|0/0/0|

|emqx@172.26.0.8|运行中|15 小时 12 分 30 秒|

为啥集群会主动断开与MQTTX的连接,不能一直连接上吗?需要改啥配置才能一直连接,还是说就不支持?

字数限制,MQTTX日志中间部分被删除,完整日志见附件。

log.zip (2.2 KB)

[2024-12-02 09:59:56] [INFO] Assigned ID 5de6bd5a-368b-40c4-9a42-46f8bdaca623 to MQTTX client

[2024-12-02 09:59:56] [INFO] Client test集群 connected using MQTT/TCP connection at mqtt://8.146.204.218:1883

[2024-12-02 09:59:56] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 09:59:56] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 10:00:57] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:00:57] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

… …

[2024-12-02 10:29:47] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 10:30:48] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:30:48] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:31:49] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:31:49] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:32:50] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:32:50] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:33:51] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:33:51] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:35:21] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 10:35:21] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 10:35:21] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 10:35:21] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 10:35:26] [INFO] Retrying connection for test集群, attempt: [2/10]

[2024-12-02 10:35:26] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 10:35:26] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 10:35:26] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 10:36:27] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:36:27] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:37:28] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:37:28] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:38:29] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:38:29] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:39:30] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:39:30] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:40:30] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:40:30] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:41:31] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:41:31] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:42:31] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:42:31] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:43:31] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:43:31] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:44:32] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:44:32] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:45:32] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:45:32] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:46:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:46:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:47:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:47:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:49:15] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 10:49:15] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 10:49:15] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 10:49:15] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 10:49:20] [INFO] Retrying connection for test集群, attempt: [3/10]

[2024-12-02 10:49:20] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 10:49:20] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 10:49:20] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 10:50:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:50:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:51:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:51:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:52:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:52:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:53:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:53:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:54:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:54:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:55:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:55:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:56:25] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:56:25] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:57:25] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:57:25] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:58:26] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:58:26] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 10:59:26] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 10:59:26] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:00:27] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:00:27] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:01:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:01:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:03:15] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 11:03:15] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 11:03:15] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 11:03:15] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 11:03:20] [INFO] Retrying connection for test集群, attempt: [4/10]

[2024-12-02 11:03:20] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 11:03:20] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 11:03:20] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 11:04:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:04:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:05:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:05:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:06:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:06:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:07:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:07:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:08:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:08:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:09:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:09:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:10:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:10:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:11:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:11:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:12:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:12:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:13:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:13:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:14:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:14:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:15:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:15:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:16:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:16:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:17:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:17:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:18:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:18:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:19:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:19:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:20:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:20:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:47:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:47:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:48:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:48:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:49:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:49:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:50:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:50:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:51:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:51:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:53:15] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 11:53:15] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 11:53:15] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 11:53:15] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 11:53:20] [INFO] Retrying connection for test集群, attempt: [8/10]

[2024-12-02 11:53:20] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 11:53:20] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 11:53:20] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 11:54:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:54:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:55:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:55:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:56:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:56:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:57:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:57:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:58:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:58:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 11:59:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 11:59:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:00:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:00:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:01:58] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:01:58] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:02:59] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:02:59] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:03:59] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:03:59] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:05:00] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:05:00] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:06:00] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:06:00] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:07:00] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:07:00] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:08:30] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 12:08:30] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 12:08:30] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 12:08:30] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 12:08:35] [INFO] Retrying connection for test集群, attempt: [9/10]

[2024-12-02 12:08:35] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 12:08:35] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 12:08:35] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 12:09:36] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:09:36] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:10:37] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:10:37] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:11:38] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:11:38] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:12:39] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:12:39] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:13:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:13:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:15:15] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 12:15:15] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 12:15:15] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 12:15:15] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 12:15:20] [INFO] Retrying connection for test集群, attempt: [10/10]

[2024-12-02 12:15:20] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 12:15:20] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 12:15:20] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 12:16:21] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:16:21] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:17:22] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:17:22] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:18:23] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:18:23] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:19:24] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:19:24] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:20:45] [DEBUG] [test集群] Sent packet: {“cmd”:“pingreq”}

[2024-12-02 12:20:45] [DEBUG] [test集群] Received packet: {“cmd”:“pingresp”,“retain”:false,“qos”:0,“dup”:false,“length”:0,“topic”:null,“payload”:null}

[2024-12-02 12:22:15] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 12:22:15] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 12:22:15] [INFO] The connection test集群 (clientID mqttx_b11a6888) is offline. MQTT.js onOffline trigger

[2024-12-02 12:22:15] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

[2024-12-02 12:22:20] [WARN] Max reconnect limit reached, stopping retries

[2024-12-02 12:22:20] [DEBUG] [test集群] Sent packet: {“cmd”:“connect”}

[2024-12-02 12:22:20] [WARN] MQTTX force closed the connection test集群 (Client ID: mqttx_b11a6888)

[2024-12-02 12:22:20] [DEBUG] [test集群] Received packet: {“cmd”:“connack”,“retain”:false,“qos”:0,“dup”:false,“length”:22,“topic”:null,“payload”:null,“sessionPresent”:false,“reasonCode”:0,“properties”:{“receiveMaximum”:32,“maximumPacketSize”:1048576,“retainAvailable”:true,“sharedSubscriptionAvailable”:true,“subscriptionIdentifiersAvailable”:true,“topicAliasMaximum”:65535,“wildcardSubscriptionAvailable”:true}}

[2024-12-02 12:22:20] [INFO] Successful connection for test集群, MQTT.js onConnect trigger

[2024-12-02 12:23:50] [DEBUG] [test集群] Received packet: {“cmd”:“disconnect”,“retain”:false,“qos”:0,“dup”:false,“length”:2,“topic”:null,“payload”:null,“reasonCode”:141}

[2024-12-02 12:23:50] [WARN] Received disconnect packet from Broker. MQTT.js onDisconnect trigger

[2024-12-02 12:23:50] [INFO] Connection for test集群 closed, MQTT.js onClose trigger

这个日志“reasonCode”:141 说明是 keepalive timeout 断掉的。可以上传一下 emqx 的日志debug 日志分析下。

你看下,其中2个节点的日志

log-1.zip (31.6 KB)
log-2.zip (19.7 KB)


从 emqx 和 mqttx 的日志来看都是 90 秒(1.5倍的心跳时间)没有发心跳就断开了(合理)。
请问一下,你mqttx 的版本是多少,我得和同事确定一下问题。

我用的


挂了 10 分钟都没有这个问题。

刚看了下MQTTX的版本是
Version: v1.10.1

好的,我找同事确定来一起看看…

因为昨天我也遇到过2次,刚开始以为是我自己测试关闭集群某个节点的问题,验证后发现短暂断开能自己自动连接上。

今天上午9:59分我又连接集群,我看了下MQTTX的日志时间是2个小时20多分钟时间就自动断开了。

多谢支持,麻烦你了。

desktop 因为实现在了 ui 层,一段时间后不操作会 freeze,然后就断了
跟浏览器的默认行为一样
只有 cli 才能稳定的长连接…
目前 2.0 正在改善
建议长连接测试用 mqttx cli

相关的讨论在这里:

我集群是在ubuntu宿主服务器,上配置的2个节点的docker mqtt容器节点。

看了你发的最后一个连接说的是MQTTX自动断开的,但是看日志是集群给客户端MQTTX下发的disconnet的指令。

可能没理解问题,我也再多看看,感谢您的答复。

是的,我说的是 mqttx 客户端目前没有办法实现稳定的长连接。要用命令行。

好的,非常感谢。