-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load balancing mosquitto broker #3007
Comments
Generally, i think load-balaning mosquitto brokers this way is a bad habbit. I haven't tried this myself due to the nature of how client-ids play into queuing. You also have a synchronization issue where you don't know which retained message is the latest one due to potential in-flight messages. Partially sent messages on one broker will not match message ids on the other broker either. My recommendation is that you pick a broker more suitable for clustering or just roll with one broker. You could also look into mosquitto pro version that should have support for HA. |
Hi @Daedaluz, thanks for your reply. I've created a simple diagram to illustrate the issue I'm currently facing. If you need the It seems that Cadelo's HA Mosquitto involves directing traffic from the load balancer to a designated lead node, with other brokers set in follower mode. They synchronize data using their Cluster Management tool. In case the lead node fails, traffic is redirected to another node, addressing downtime but not achieving true load balancing. Is it currently not possible for Mosquitto to implement Load Balancing functionality? I saw that |
Not while retaining proper MQTT functionality at least. I don't know what would cause your retained messages to not eventually reach all brokers, but some configs affecting this is one good guess would be to set
however, this probably also has a side-effect that all queued messages with qos > 0 on the other broker will be dropped while down because the persistence broker should remove the subscriptions. Expect more quirks down the road. |
I'm currently deploying three Mosquitto brokers using Kubernetes, with two of them handling external load balancing. I have configured connections in
mosquitto.conf
to bridge internally. However, when testing retain messages, I noticed that due to load balancing, subscribers only receive half of the messages. The other half is received only when connected to the second external broker. I'd like to know how to ensure that subscribers receive the original quantity of retain messages sent by the publisher.The text was updated successfully, but these errors were encountered: