【问题标题】:Mosquitto - No data in $SYS topicsMosquitto - $SYS 主题中没有数据
【发布时间】:2017-08-15 18:45:33
【问题描述】:

我的设置有 mosquitto 1.4.12 使用 TLS 和用户/通过身份验证,它在 Ubuntu 14.04 下运行了很长一段时间没有问题。

问题是没有数据发布到任何$SYS 代理状态主题。我已经查看了配置,sys_interval 设置为 10。还需要什么其他东西才能让它工作吗?

我尝试了很多客户端(mosquitto_sub、paho-mqtt、mqtt.fx),所以它看起来像是一个错误的 mosquitto 配置,而不是客户端问题。

mosquitto.conf 看起来像这样:

sys_interval 10

max_queued_messages 10000
max_inflight_messages 100
max_connections -1

connection_messages true
log_dest stderr
log_type error
log_type warning
log_type notice
log_type information
log_type all
log_timestamp true

password_file /etc/mosquitto/conf.d/jp.pw
acl_file /etc/mosquitto/conf.d/acl.conf

persistence true
persistence_location /var/lib/mosquitto/
persistence_file mosquitto.db
persistent_client_expiration 1m
autosave_interval 600
retained_persistence true

listener 8883
tls_version tlsv1.2

cafile /etc/mosquitto/ca_certificates/ca.crt
certfile /etc/mosquitto/ca_certificates/cert.crt
keyfile /etc/mosquitto/ca_certificates/cert.key
require_certificate false
allow_anonymous false

acl.conf 有这个,可能不需要:

user test
topic #

【问题讨论】:

  • 您到底要订阅什么? $SYS 主题不会出现在 # 订阅中。您必须订阅$SYS/#才能查看所有数据
  • 是的 @hardillb ,我正在订阅特定主题,例如 $SYS/broker/clients/active$SYS/broker/uptime
  • 在这种情况下,请编辑问题以包括您的 mosquitto.conf 和您设置的任何 ACL,以便我们查看您的设置
  • 刚刚完成,@hardillb。谢谢。
  • 添加一个以$SYS/# 结尾的额外主题行,以防万一主题匹配用于检查ACL

标签: mqtt mosquitto


【解决方案1】:

ACL 中的主题过滤器应用与正常通配符处理相同的规则,因此仅允许访问 # 不会涵盖“$SYS/#”主题。

您需要在 ACL 中添加额外的 topic 行以包含 $SYS 主题:

user test
topic #
topic $SYS/#

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 1970-01-01
    • 2021-12-04
    • 1970-01-01
    • 2022-11-12
    • 1970-01-01
    相关资源
    最近更新 更多