How to avoid HAProxy restart on node faliure


#1

Hi All,

we are running HAProxy on ubuntu 14.04 system with two MQTT broker. When one of the MQTT node fail, HAProxy is getting restarted(paho client is getting disconnected).

We do not need Paho client to get disconnected as one of the MQTT broker node fails. we would like to know is there any configuration change in haproxy.cfg file or anything else.

Let us know if you need any further information to answer above question.

Thanks


#2

How do you know haproxy is restarted? Do you see haproxy PID changing?

It is expected behavior that the client disconnects when the backend fails.

And btw you are posting in the “Configuration Samples” section, while this posts belongs to the Help section.


#3

Hi Lukastribus,

Thank you very much for your shift response.

PID did not change when one of the MQTT node fails.

But Paho Client which is connect to HAProxy got disconnected when one of the MQTT node stopped.

I understand Paho client getting disconnect which is connect to MQTT broker but why should paho client which is connected to HAProxy got disconnect. I need clarity on this.

HAProxy is load balancer if one of the node fail from its child node it should not get disturbed/disconnect client. --> This is our understanding.


#4

OK, so haproxy is perfectly stable and does not restart.

Which is expected behavior. Haproxy cannot interrupt an abitrary TCP session on one side and suddenly connect it to a different TCP backend. This is not technically possible, as it would corrupt and brake whatever data/session/application your protocol carries.

Expected behavior, see above.

If a backend dies, your client needs to be aware of it. Only in HTTP mode with keepalive and only between HTTP transactions, haproxy can switch to a different backend.

But that is not the case for arbritrary TCP payload.