We use HAProxy as load balancer for regular HTTP requests. I see no reference to telnet connections in the HAProxy configuration guide: HAProxy config guide.

I was hoping to reuse HAProxy (or spin up separate instances for long lived connections) to load balance TCP clients, can this be done with HAProxy?

  • Yes, that should be possible. HAProxy is a generic TCP load balancer that just happens to be used mostly for HTTP connections. But telnet? – Sven Sep 16 '15 at 10:33
  • I'm curious about the rest of the environment. Where are you using Telnet these days? – ewwhite Sep 16 '15 at 10:37
  • @sven Thanks, thats what I thought -- its just TCP right :) -- but I cannot see any examples, anywhere! would you know of any examples or documentation? – user1843591 Sep 16 '15 at 10:45
  • hi @ewwhite, we have a management server that manages many clients and many client types, they all use various connection protocols. Some legacy products use things like telnet. We do not control the protocol of our client machines so we must comply to be able to manage. – user1843591 Sep 16 '15 at 10:48
  • I've no example ready, but from what I read it be sufficient to set the connection mode to tcp instead of http, bind to port 23 instead of 80 and remove all http-relevant options in a config file (e.g. neo4j.com/docs/stable/ha-haproxy.html). – Sven Sep 16 '15 at 10:51

It is simple enough to use HAProxy to load balance any TCP connection including telnet (most protocols are very similar to telnet anyway). But you should enable persistence by source IP and for long lived connections you should make sure you set long timeouts and keepalive i.e.

clitimeout 1h
srvtimeout 1h
mode tcp
option tcpka

This is an example for RDP load balancing which is a similar long held TCP connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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