简体   繁体   中英

mosquitto : broker stop publish to some clients but subscription ok

The context:

  1. mosquitto broker 1.5.7 running on a private cloud:

Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux

Extract of mosquitto.conf:

allow_anonymous false
password_file /etc/mosquitto/passwd
log_type all
  1. X clients (nodeJS mqtt package) SUB on the same topic xxx

Extract of their nodeJS config:

reconnectPeriod: 30000  (ms)
keepalive: 300  (sec) 
qos: 2 
clean = false

(version of node mqtt module: 3.0.0)

  1. Another client PUB in QoS2 on topic xxx

The problem:

PUB/SUB on the topic xxx worked fine during the first few hours, but clients (SUB) suddenly stop to received messages. Clients (SUB) are well connected and subscribed to the broker.

When I check the broker #$SYS,I can see:

  • "$SYS/broker/clients/active" OK
  • "$SYS/broker/clients/connected" OK (same number of active)
  • "$SYS/broker/subscriptions/count/" OK

When I check on the "mosquitto log", I can see the broker PUBLISH message only to 3 of my 7 SUB clients... so it is understandable my 4 others clients never received the message...

What Can I do to resolve this strange problem?

Thank for your help.

I finally find a solution to make my architecture work: I switch the Qos SUB of all my devices to Qos1 (instead of Qos2).

My conclusion is the Qos2 on SUB is not well managed by the broker if multiple subscribers on the same topic (7 in my case).

In this case: turn Qos SUB to Qos 1 and it works fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM