fallback MQTT gateway
-
would it be somehow possible to change the MQTT gateway that it accepts a second broker IP in case connection to primary is lost?
I am trying to have my setup more reliable in case something brakes.
-
Did you ever implement this?
I had some thought along the lines of doing some failover or reverse proxy type setup on my LAN (or VPN / intranet if I eventually get to the point of multiple sites). But these have just been off the top of my head thoughts when thinking (apparently) along the same lines as you.
Curious to hear what others may have done though.
-
I didn't find a solution to this on gateway code. What I did and seems to be working more or less.
I have two instances running MQTT and OpenHAB. One is active, other is inactive. Both obviously do have separate IP addresses, however I have managed with "keepalive" to put a virtual IP in front. All I had to do was reflashing my gateway to the virtual IP.
So if one of the nodes is going down, the other one becomes the master and binds to the virtual IP.
In addition to have this seemless, the MQTT servers have a subscription to the other one. This solves the issue, that in case of a failure, there is no current data on that instance.
OpenHAB itself was always setup in a manner that I am able to run two instances (development and production) side by side and get updates on stats of all items.On hardware level, I run a server on Ubuntu with VirtualBox where the instances run. On top, I have another standy node running on a RasPi.
-
Interesting. Thanks for the explanation.