如何解决蚊子桥协议错误
我已经在Ubuntu 18.04上安装了蚊子。我正在尝试连接到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/
蚊子服务运行正常,但在日志中,我可以看到协议错误。
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.
我什至尝试从1.2
到1.3
更改tls_version
,但这无济于事。为什么我会遇到协议错误?
I have installed Mosquitto on Ubuntu 18.04. I am trying to connect to Azure IoT Hub. Below is the content of 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
Below is the bridge.conf
file
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/
The Mosquitto service is running fine but in logs I can see protocol error.
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:
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.
I have even tried changing the tls_version
from 1.2
to 1.3
but it didn't help. Why am I getting a protocol error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MQTT的默认版本将为3.1
添加
bridge_protocolo_version
选项,并接受mqttv31
和mqtttv311
注意:
The default version of MQTT will be 3.1
Add the
bridge_protocolo_version
option to the config and it acceptsmqttv31
andmqttv311
Note:
Disable privilege bridge extension.