I've been considering Mosquitto for a MQTT message broker for a home IoT network, but I'm concerned that the broker could be a single point of failure which could bring down my whole network if it failed, since all messages have to go through the broker and no messages can be transmitted at all if the broker goes offline for any reason (e.g. accidental unplugging, hardware failure, etc.)

Would be possible to use multiple brokers with Mosquitto installed to improve the reliability of the network? If it is possible, are there any disadvantages/significant overheads to using multiple brokers?

2 Answers 2


Yes, Mosquitto does support multiple brokers.

Mosquitto uses MQTT Bridges to connect multiple brokers thus routing messages between these mosquitto brokers. This way a bridge between your primary broker to a fallback system can be established. Avoid creating loops though. If both brokers run your clients publish to the primary broker which then publishes the topic to each and any subscriber including the bridged secondary broker. If the primary fails your clients will note (Connection Refused, Server unavailable) and can fallback to directly publish to the secondary. (I am not yet sure how to fix it the other way round.) As you're not expecting the client to disconnect ungracefully I think that "Last Will and Testament" do not apply here (it would be used to have the broker notify on behalf of a disconnected client).

This post however lists the drawbacks of this approach especially with respect to scalability and availability:

  • The bridge routing mechanisms don’t scale well if you forward all messages to the other bridges
  • The communication overhead between bridges is significant if you’re using QoS 2 between bridges (which you need to do if you want to propagate messages between clients that are connected to different bridges)
  • There is no failover and high availability. If a broker bridge crashes, messages may get lost
  • MQTT clients cannot be migrated to other bridge nodes. MQTT sessions are not replicated across bridges, so you will lose all your queued messages and subscriptions if you’re using MQTT persistent sessions.

In .NET the implementation allows to connect one client to one broker, so I'd say why not...

MqttClient mqtt;
string broker = ini.getData("MQTT", "hostname");
mqtt = new MqttClient(broker);
mqtt.MqttMsgPublishReceived += mqtt_received;

Thing is, you must manage duplicates in case of a fallback when the other broker will start sending messages, or warn the clients.

There can be several possibilities like each broker subscribes to each other and set a Last Will and Testament to warn themselves and their clients that a fallback will occur!

  • How can a broker subscribe or more like connect to another broker? Commented Dec 14, 2016 at 11:25
  • 1
    I was thinking of a client nested on the broker's server.
    – Goufalite
    Commented Dec 14, 2016 at 12:34
  • @Goufalite, this is really useful for MQTT in general, thanks. Would you happen to know any more about Mosquitto, the broker I discussed in the question?
    – Aurora0001
    Commented Dec 14, 2016 at 14:50
  • This is the lowest thing I know about MQTT (I didn't realized there were other broker like HiveMQ before coming on IoT SE). What else would you like to know? You mean implementation?
    – Goufalite
    Commented Dec 14, 2016 at 15:48
  • @Goufalite just interested whether Mosquitto itself has a way of running multiple brokers in parallel. If you could suggest a way to do it with Mosquitto or link documentation that'd be great.
    – Aurora0001
    Commented Dec 14, 2016 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.