如何设置代理连接MQTT桥?

问题描述 投票:1回答:1

我有一个mosquitto经纪人在我的公司代理后面的linux上运行。我已经配置了与AWS相同的桥梁:(mosquitto.conf)

connection bridge
address ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089
remote_username admin
remote_password password
topic abc/raspi01 both 0
bridge_cafile /etc/pki/tls/certs/nginx-selfsigned.crt
bridge_insecure false

但是当我用命令启动mosquitto服务时:

service mosquitto restart

在日志文件中,有一些错误:

1554356888: mosquitto version 1.5.5 starting
1554356888: Config loaded from /etc/mosquitto/mosquitto.conf.
1554356888: Opening ipv4 listen socket on port 1883.
1554356888: Opening ipv6 listen socket on port 1883.
1554356888: Warning: Address family not supported by protocol
1554356888: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356888: Error creating bridge: Name or service not known.
1554356888: Warning: Unable to connect to bridge bridge.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New client connected from 127.0.0.1 as mqtt_fd05fada.b70918 (c1, k60).
1554356901: New client connected from 127.0.0.1 as mqtt_2a3a025d.6c941e (c1, k60).
1554356919: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356919: Error creating bridge: Name or service not known.
1554356950: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356950: Error creating bridge: Name or service not known.

我的事情是我的公司代理。我试过mosquitto.service中的设置,但它没有解决。

[Unit]
Description=Mosquitto MQTT v3.1/v3.1.1 Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Environment="HTTPS_PROXY=http://user:pass@proxyhost:8800"
Environment="HTTP_PROXY=http://user:pass@proxyhost:8800"
Environment="NO_PROXY=127.0.0.1,localhost"
Restart=on-failure

[Install]
WantedBy=multi-user.target

有谁能够帮我?非常感谢。

proxy mqtt mosquitto
1个回答
0
投票

您不能将HTTP代理用于MQTT桥接连接(或任何本机MQTT连接)。 MQTT是一种完全不同的协议。

只有基于Websockets的MQTT才能通过HTTP代理工作,但您无法配置mosquitto以通过Websockets运行MQTT桥接。

© www.soinside.com 2019 - 2024. All rights reserved.