Eclipse-蚊子 "Address not available"
Eclipse-mosquitto "Address not available"
我是 mqtt 的新手,我想简单地启动一个本地实例,我可以用它来测试。
执行时
docker run -it -p 1883:1883 --restart always -v mosquitto.conf:/home/juliette/mosquito.conf --name mqtt eclipse-mosquitto:2.0.7
我得到以下输出:
1615963221: mosquitto version 2.0.7 starting
1615963221: Config loaded from /mosquitto/config/mosquitto.conf.
1615963221: Starting in local only mode. Connections will only be possible from clients running on this machine.
1615963221: Create a configuration file which defines a listener to allow remote access.
1615963221: Opening ipv4 listen socket on port 1883.
1615963221: Opening ipv6 listen socket on port 1883.
1615963221: Error: Address not available
1615963221: mosquitto version 2.0.7 running
并且无法连接到 mqtt 客户端:
mqtt sub --topic test
Server closed connection without DISCONNECT.
从我发现的情况来看,错误显然发生在没有配置侦听器但我配置了一个时,这是我的 mosquito.conf:
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
port 1883
我也尝试过将端口更改为 8883,因为在一个 post 中有人提到更大的端口可能会解决问题,但也没有用。
谁能告诉我哪里做错了?
您的启动命令很接近,但不正确。应该是:
docker run -it \
-p 1883:1883 \
--restart always \
-v /home/juliette/mosquito.conf:/etc/mosquitto/mosquitto.conf \
--name mqtt \
eclipse-mosquitto:2.0.7
配置文件在 /etc/mosquitto
...除非他们在版本 2 中移动了它。
您可能还想为 mqtts/TLS 个连接添加 -p 8333:8333
行。
编辑:我在你的日志文件输出中看到它说配置是从 /mosquitto/config/mosquitto.conf
加载的......所以如果 -v /home/juliette/mosquito.conf:/etc/mosquitto/mosquitto.conf
行不起作用,将其更改为 -v /home/juliette/mosquito.conf:/mosquitto/config/mosquitto.conf
我是 mqtt 的新手,我想简单地启动一个本地实例,我可以用它来测试。
执行时
docker run -it -p 1883:1883 --restart always -v mosquitto.conf:/home/juliette/mosquito.conf --name mqtt eclipse-mosquitto:2.0.7
我得到以下输出:
1615963221: mosquitto version 2.0.7 starting
1615963221: Config loaded from /mosquitto/config/mosquitto.conf.
1615963221: Starting in local only mode. Connections will only be possible from clients running on this machine.
1615963221: Create a configuration file which defines a listener to allow remote access.
1615963221: Opening ipv4 listen socket on port 1883.
1615963221: Opening ipv6 listen socket on port 1883.
1615963221: Error: Address not available
1615963221: mosquitto version 2.0.7 running
并且无法连接到 mqtt 客户端:
mqtt sub --topic test
Server closed connection without DISCONNECT.
从我发现的情况来看,错误显然发生在没有配置侦听器但我配置了一个时,这是我的 mosquito.conf:
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
port 1883
我也尝试过将端口更改为 8883,因为在一个 post 中有人提到更大的端口可能会解决问题,但也没有用。
谁能告诉我哪里做错了?
您的启动命令很接近,但不正确。应该是:
docker run -it \
-p 1883:1883 \
--restart always \
-v /home/juliette/mosquito.conf:/etc/mosquitto/mosquitto.conf \
--name mqtt \
eclipse-mosquitto:2.0.7
配置文件在 /etc/mosquitto
...除非他们在版本 2 中移动了它。
您可能还想为 mqtts/TLS 个连接添加 -p 8333:8333
行。
编辑:我在你的日志文件输出中看到它说配置是从 /mosquitto/config/mosquitto.conf
加载的......所以如果 -v /home/juliette/mosquito.conf:/etc/mosquitto/mosquitto.conf
行不起作用,将其更改为 -v /home/juliette/mosquito.conf:/mosquitto/config/mosquitto.conf