问题描述
我正在使用Paho MQTT客户端与本地客户端进行小型IoT项目,将mqtt数据发送到本地mosquitto代理(充当网桥),然后发送到我的远程代理(SAP IoT Cloud).
I'm doing a small IoT project with a local client using Paho MQTT client, sending mqtt data to a local mosquitto broker (acting as bridge) and then to my remote broker (SAP IoT Cloud).
从客户端到远程代理的数据流(使用TLS)正在成功运行,现在我正努力在相应位置之间放置和配置桥接器.
The data flow from client to remote broker (using TLS) is working successfully and now I'm struggling to place and configure the bridge between accordingly.
由于我必须对mqtt消息(QoS 1)使用TLS,因此创建了另一个具有端口8883的侦听器.还提供与用于发送代理的客户端相同的CA文件,用于与远程代理进行身份验证.一旦使用下面指定的配置启动代理(我还没有启动本地客户端),我将收到不可接受的协议版本的错误消息(请参见下面的日志文件).因此无法建立到我的远程代理的网桥连接,但是为什么呢?
As I have to use TLS for the mqtt messages (QoS 1), a second listener with port 8883 is created. Also the same CA file for authentication with the remote broker, as the client used for sending is provided. Once I start my broker (I haven't started my local client yet) with the stated config below I'll get error messages on an unacceptable protocol version (see log file below). So the bridge connection to my remote broker can't be established, but why?
以前我遇到过同样的问题,然后发现我使用的是旧的mosquitto版本(1.4.10),并进行了相应的更新.但是对于v1.6.7,它也不起作用.
I've had the same problem before and then I've found out that I was using a old mosquitto version (1.4.10) and updated it accordingly. But also with v1.6.7 it's not working.
任何提示都将受到高度赞赏.某些信息已取消个性化设置(例如在远程代理中用作clientId的连接名称,端点地址)
Any hints are highly appreciated. Some information are depersonalized (like connection name which is used as clientId in remote broker, endpoint address)
一些必要的信息:
- Mosquitto Broker版本1.6.7
- 操作系统:Debian Stretch
- 我的经纪人的配置
connection raspberryPiZero
address xxxxxxxx.eu10.cp.iot.sap:8883
topic # both 1
log_type all
listener 8883
bridge_cafile /etc/mosquitto/certs/CAcert.pem
- 日志文件mosquitto
1574754457: mosquitto version 1.6.7 starting
1574754457: Config loaded from /etc/mosquitto/mosquitto.conf.
1574754457: Opening ipv4 listen socket on port 1883.
1574754457: Opening ipv6 listen socket on port 1883.
1574754715: mosquitto version 1.6.7 terminating
1574754715: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1574754721: mosquitto version 1.6.7 starting
1574754721: Config loaded from /etc/mosquitto/mosquitto.conf.
1574754721: Opening ipv4 listen socket on port 8883.
1574754721: Opening ipv6 listen socket on port 8883.
1574754721: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754721: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754726: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754726: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754741: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754741: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754741: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754741: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754742: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754742: Connection Refused: unacceptable protocol version
1574754742: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754747: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754747: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754747: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754747: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754747: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754747: Connection Refused: broker unavailable
1574754747: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754775: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754775: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754776: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754776: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754776: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754776: Connection Refused: broker unavailable
1574754776: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754781: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754781: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754782: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754782: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754782: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754782: Connection Refused: broker unavailable
1574754782: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754787: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754787: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754788: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754788: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754788: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754788: Connection Refused: broker unavailable
1574754788: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754793: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754793: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754794: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754794: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754794: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754794: Connection Refused: broker unavailable
1574754794: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754799: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754799: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754800: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754800: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754800: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754800: Connection Refused: broker unavailable
1574754800: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754805: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754805: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754806: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754806: Bridge raspberrypi.raspberryPiZero sending CONNECT
1574754806: Received CONNACK on connection local.raspberrypi.raspberryPiZero.
1574754806: Connection Refused: broker unavailable
1574754806: Socket error on client local.raspberrypi.raspberryPiZero, disconnecting.
1574754811: Bridge local.raspberrypi.raspberryPiZero doing local SUBSCRIBE on topic #
1574754811: Connecting bridge (step 1) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754812: Connecting bridge (step 2) raspberryPiZero (xxxxxxxx.eu10.cp.iot.sap:8883)
1574754812: mosquitto version 1.6.7 terminating
1574754812: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
推荐答案
默认情况下,mosquitto尝试使用MQTT 3.1建立网桥
By default mosquitto tries to set up bridges with MQTT 3.1
您可以通过在接受mqttv31
和mqttv311
bridge_protocol_version mqttv311
尝试使用3.11
还通过以下方式禁用mosquitto专用网桥扩展:
Also disable the mosquitto private bridge extensions with:
try_private false
这篇关于Mosquitto Broker Bridge配置-协议版本不可接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!