跳到主要内容
版本:Next

Mosquitto

Eclipse Mosquitto 是一个 物联网消息队列平台,它被用于 MQTT 消息队列 等场景。Eclipse Mosquitto is an open source implementation of a server for versions 5, 3.1.1, and 3.1 of the MQTT protocol.

GUI

准备

在参阅本文档使用 Eclipse Mosquitto 时,需要确保如下几点:

  • 应用是基于 Websoft9 安装的

  • 应用的用途符合 EPL-2.0 开源许可协议

  • 应用具备访问条件:配置域名服务器安全组开启网外端口

入门指南

开启认证

Mosquitto 开启认证有多种方式,下面我们介绍其中的密码文件方式:

  1. 进入 Mosquitto 容器,参考下面的命令创建一个密码文件(文件名、用户名和密码均可自定义)

    mosquitto_passwd -H sha512  -c -b /mosquitto/config/passwd_file yourusername yourpasssord
  2. 修改配置文件中的如下两项(必须):

    • password_file 设置为: /mosquitto/passwd_file
    • allow_anonymous 设置为: false
  3. 重建应用后生效

可视化管理

参考:MQTTX

配置选项

  • 配置文件(已挂载):/mosquitto/config/mosquitto.conf
  • 用户认证(√)

管理维护

故障

容器日志 Error: Address not available?

Mosquitto 2.0 requires you to configure listeners and authentication before it will allow connections from anything other than the loopback interface.