1
votes

I am working on a project where I have to connect local mqtt broker i.e. mosquitto and a cloud based mqtt broker via mqtt bridge. Mosquitto(local broker) is running on raspberry pi4 and I also want to run mosquitto mqtt bridge on same raspberry pi. So the question is, Can I run local mqtt broker i.e. mosquitto and the mqtt bridge both simultaneously in a single system which is raspberry pi4. If yes please tell the process how can i do it.

1
Welcome to stack overflow. A question is more easy to answer if you provide examples for people to begin with. Have you tried running it on the same system yourself? What errors appear?studioj

1 Answers

3
votes

You only need to run a single MQTT broker (e.g. 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

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.