简体   繁体   English

同一系统上的 Mqtt 代理和 mqtt 桥接器

[英]Mqtt broker and mqtt bridge on same system

I am working on a project where I have to connect local mqtt broker ie mosquitto and a cloud based mqtt broker via mqtt bridge.我正在做一个项目,我必须通过 mqtt 桥连接本地 mqtt 代理,即 mosquitto 和基于云的 mqtt 代理。 Mosquitto(local broker) is running on raspberry pi4 and I also want to run mosquitto mqtt bridge on same raspberry pi. Mosquitto(本地代理)在树莓派上运行,我也想在同一个树莓派上运行 mosquitto mqtt 桥。 So the question is, Can I run local mqtt broker ie mosquitto and the mqtt bridge both simultaneously in a single system which is raspberry pi4.所以问题是,我能否在一个系统中同时运行本地 mqtt 代理,即 mosquitto 和 mqtt 桥,即树莓派 pi4。 If yes please tell the process how can i do it.如果是,请告诉过程我该怎么做。

You only need to run a single MQTT broker (eg mosquitto).您只需要运行一个 MQTT 代理(例如 mosquitto)。 This will act as the local broker and can also be configured to bridge out to a remote broker.这将充当本地代理,也可以配置为桥接远程代理。

The bridge can be configured to网桥可以配置为

  • mirror messages out to the remote broker将消息镜像到远程代理
  • mirror messages in from the remote broker从远程代理镜像消息
  • or both或两者

Depending on what you need.取决于你需要什么。 Details of how to configure the bridge can be found in the mosquitto docs here如何配置网桥的详细信息可以在 mosquitto 文档中找到

But if you want to run multiple brokers on the same machine this is also perfectly possible, they will just need to bind to different ports as only one will be able to bind to 1883.但是如果你想在同一台机器上运行多个代理,这也是完全可能的,它们只需要绑定到不同的端口,因为只有一个能够绑定到 1883。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM