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.
准备
在参阅本文档使用 Eclipse Mosquitto 时,需要确保如下几点:
入门指南
开启认证
Mosquitto 开启认证有多种方式,下面我们介绍其中的密码文件方式:
-
进入 Mosquitto 容器,参考下面的命令创建一个密码文件(文件名、用户名和密码均可自定义)
mosquitto_passwd -H sha512 -c -b /mosquitto/config/passwd_file yourusername yourpasssord
-
修改配置文件中的如下两项(必须):
- password_file 设置为: /mosquitto/passwd_file
- allow_anonymous 设置为: false
-
重建应用后生效
可视化管理
参考: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.