If you have multiple sites using MQTT then there are various ways of connecting them together. They are
- Central Cloud based broker
- Local brokers bridged to central broker.
- Hybrid
Central Cloud Based Broker
With this arrangement local sites do not have a local broker and all clients communicate via a central cloud based broker.
This arrangement is preferred when there is no local MQTT traffic.
It has the advantage that it is much easier to configure and results in less hardware and software.
Local Brokers Bridged to Central Broker
With this arrangement local sites have a local broker and all local clients communicate via the local broker.
Traffic that needs to go to a central cloud based broker must be bridged by the local broker.
This arrangement involves much more hardware, software and setup than using a single central broker.
It has the advantage of reducing Internet traffic and improved local network latency and resilience which is important if local control of devices is required.
Hybrid
In this model some but not all sites will have local brokers.
Some sites will communicate directly with the central broker.
The Central Broker
This can be a cloud based broker provided by your own server/virtual server on the Internet or a cloud based MQTT service like cedalo or cloudmqtt etc.
It can even be one of your own server located at a site that is reachable from outside the local network.
If you are worried about fault tolerance many cloud MQTT services offer high availability solutions.
Using SSL
Depending on the data/application you may feel the need to implement security using SSL.
Using local MQTT brokers gives you the option of using SSL on the bridge connection but not on the Local clients.
IN addition because the bridge in mosquitto supports pre shared key encryption then no certificates would be required.
Common Questions and Answers
Q1- I am using mosquitto bridges to connect to a central site is my topic design important?
A- Yes by designing the topic structure so that traffic to the central broker is easy to filter then you can reduce the traffic sent over the Internet to the central broker.
Related tutorials and resources:
- MQTT Sensors and Network Traffic Observations
- Mosquitto MQTT Bridge -Usage and Configuration
- Configure a Mosquitto Bridge With SSL Encryption
- Python MQTT Bridge Project
- MQTT Client Message Queueing and Delivery
Hi Steve
I eventually used a combination of the MQTT Broker provided in the OpenSource on the IBM i server (The one I have Node-RED running on) and a MyQttHub Cloud based MQTT server. It works well. Although I didn’t ever manage to get the Mosquitto working (Probably an IBM i limitation) that you proposed, nonetheless you steered me in exactly the right direction. Thank you.