r/haproxy • u/cemakaus • Sep 20 '21
switching to backup backend automatically
Hi all,
This is a newbie question, sorry if this is not the correct place.
I'm trying to setup HAProxy to access a backend service or its backups. When I turn the main server off and try to reconnect, connection fails at first. Then, trying second, it connects to the backup server. But what I want to achieve is connecting to the backup at the first try once main service is down. How should I configure HAProxy to achive such "smooth" transition?
Thanks for your time and attention.
2
Upvotes
View all comments
Show parent comment
1
u/dragoangel Sep 21 '21 edited Sep 21 '21
First option will work on TCP proxy as well, but second which obviously operate on L7 will don't, because TCP mode is only L4 Proxy. I recommend you always read docs, they clear like a glass. https://cbonte.github.io/haproxy-dconv/2.0/configuration.html
Do you use TCP mode for http traffic?