简体   繁体   English

mosquitto:代理停止向某些客户端发布但订阅正常

[英]mosquitto : broker stop publish to some clients but subscription ok

The context:上下文:

  1. mosquitto broker 1.5.7 running on a private cloud:在私有云上运行的 mosquitto broker 1.5.7:

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

Extract of mosquitto.conf: 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 X 客户端(nodeJS mqtt 包)SUB 同主题 xxx

Extract of their nodeJS config:提取他们的 nodeJS 配置:

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

(version of node mqtt module: 3.0.0) (节点mqtt模块版本:3.0.0)

  1. Another client PUB in QoS2 on topic xxx QoS2 中关于主题 xxx 的另一个客户端 PUB

The problem:问题:

PUB/SUB on the topic xxx worked fine during the first few hours, but clients (SUB) suddenly stop to received messages.在最初的几个小时内,关于主题 xxx 的 PUB/SUB 运行良好,但客户端 (SUB) 突然停止接收消息。 Clients (SUB) are well connected and subscribed to the broker.客户端 (SUB) 连接良好并订阅了代理。

When I check the broker #$SYS,I can see:当我检查代理#$SYS 时,我可以看到:

  • "$SYS/broker/clients/active" OK "$SYS/broker/clients/active" 好的
  • "$SYS/broker/clients/connected" OK (same number of active) "$SYS/broker/clients/connected" OK(相同数量的活动)
  • "$SYS/broker/subscriptions/count/" OK "$SYS/broker/subscriptions/count/" 确定

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...当我查看“mosquitto 日志”时,我只能看到代理 PUBLISH 消息发给我的 7 个 SUB 客户中的 3 个……所以可以理解,我的其他 4 个客户从未收到该消息……

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).我终于找到了使我的架构工作的解决方案:我将所有设备的 Qos SUB 切换到 Qos1(而不是 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).我的结论是,如果同一主题上有多个订阅者(在我的情况下为 7 个),则代理无法很好地管理 SUB 上的 Qos2。

In this case: turn Qos SUB to Qos 1 and it works fine!在这种情况下:将 Qos SUB 转为 Qos 1,它工作正常!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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