如何修复 Mosquitto 'exited with code 13'

当 mosquitto 以代码 13 退出时(例如在基于 docker 的设置中),你通常不会看到错误消息:

example-3.txt
mosquitto_mosquitto_1 exited with code 13

然而,**mosquitto.log 中会有错误消息。**所以,确保你在 mosquitto.conf 中配置了 log_dest file,例如:

example-2.sh

并检查该文件。在我的情况下,它显示了这些错误消息:

example-1.txt
1637860284: Config loaded from /mosquitto/config/mosquitto.conf.
1637860284: Error: Unable to open pwfile "/mosquitto/conf/mosquitto.passwd".
1637860284: Error opening password file "/mosquitto/conf/mosquitto.passwd".

在我的情况下,密码文件的路径拼错了(conf 而不是 config

注意你需要创建密码文件才能让 mosquitto 启动!

有关如何创建用户和密码文件的示例命令,请参见如何使用 docker-compose 设置独立 mosquitto MQTT 代理


Check out similar posts by category: Docker, MQTT