我在 Ubuntu 18.04 上安装了 Mosquitto。我正在尝试连接到 Azure IoT 中心。以下是
mosquitto.con
的内容:
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
下面是
bridge.conf
文件
connection iothub-bridge
log_type all
address ripe.azure-devices.net:8883
remote_username ripe.azure-devices.net/ripe001
remote_password SharedAccessSignature sr=ripe.azure-devices.net&sig=C5t0H%2F3eCS47Xnf38s%3D&se=253402297199.516&skn=iothubowner
remote_clientid ripe001
bridge_cafile /etc/ssl/certs/ca-certificates.crt
try_private false
cleansession false
start_type automatic
bridge_insecure false
bridge_protocol_version mqttv311
bridge_tls_version tlsv1.2
notifications false
#notification_topic events/
#cleansession false
#persistence true
#max_queued_messages 0
keepalive_interval 36000
autosave_interval 30
topic # out 2 devices/ripe001/messages/events/ devices/ripe001/messages/events/
topic # in 2 devices/ripe001/messages/devicebound/ devices/ripe001/messages/devicebound/
Mosquitto 服务运行良好,但在日志中我可以看到协议错误。
1650357942: mosquitto version 2.0.14 starting
1650357942: Config loaded from /etc/mosquitto/mosquitto.conf.
1650357942: Starting in local only mode. Connections will only be possible from clients running on this machine.
1650357942: Create a configuration file which defines a listener to allow remote access.
1650357942: For more details see https://mosquitto.org/documentation/authentication-methods/
1650357942: Opening ipv4 listen socket on port 1883.
1650357942: Opening ipv6 listen socket on port 1883.
1650357942: Bridge local.ripe001 doing local SUBSCRIBE on topic devices/ripe001/messages/events/#
1650357942: Connecting bridge (step 1) iothub-bridge (ripe.azure-devices.net:8883)
1650357942: mosquitto version 2.0.14 running
1650357942: Connecting bridge (step 2) iothub-bridge (ripe.azure-devices.net:8883)
1650357942: Bridge ripe001 sending CONNECT
1650357942: Client local.ripe001 disconnected: Protocol error.
蚊子版本:
mosquitto version 2.0.14
mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
See https://mosquitto.org/ for more information.
我什至尝试将
tls_version
从1.2
更改为1.3
,但没有帮助。为什么我会收到协议错误?
MQTT 的默认版本为 3.1
将
bridge_protocolo_version
选项添加到配置中,它接受 mqttv31
和 mqttv311
bridge_protocol_version mqttv311
注:
禁用权限桥扩展。
try_private false