1
votes

I am using haproxy 1.6.4 as TCP(not HTTP) proxy. My clients are making TCP requests. They do not wait for any response, they just send the data and close the connection.

How haproxy behaves when all back-end nodes are down? I see that (from the client point of view) haproxy is accepting incomming connections.

Haproxy statistics show that front-end has status OPEN, he is accepting connections.

Number of sessions and bytes-in increases for frontend, but not for back-end (he is DOWN).

Is haproxy buffering incoming TCP requests, and will pass them to the back-end once back-end is up? If yes, it is possible to configure this buffer size? Where data is buffered (in memory, disk?)

Is this possible to turn off front-end (do not accept incoming TCP connections) when all back-end nodes are DOWN?

Edit: when backend started, I see that * backend in-bytes and sessions is equal to front-end number of sessions * but my one and only back-end node has fever number of bytes-in, fever sessions and has errors.

So, it seems that in default configuration there is no tcp buffering. Data is accepted by haproxy even if all backend nodes are down, but this data is lost. I would prefer to turn off tcp front-end when there are no backend servers- so client connections would be rejected. Is that possible?

edit: haproxy log is

Jul 15 10:02:32 172.17.0.2 haproxy[1]: 185.130.180.3:11319 [15/Jul/2016:10:02:32.335] tcp-in app/ -1/-1/0 0 SC \0/0/0/0/0 0/0 908

my log format is

%ci:%cp\ [%t]\ %ft\ %b/%s\ %Tw/%Tc/%Tt\ %B\ %ts\ \%ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %U

What I understand from log:

  • there are no backeend servers
  • termination state SC translates to

    S : the TCP session was unexpectedly aborted by the server, or the server explicitly refused it. C : the proxy was waiting for the CONNECTION to establish on the server. The server might at most have noticed a connection attempt.

1
Have you read your HAProxy logs?Michael - sqlbot
I have edited question, put logs. From the logs I see that connection was not passed to the server. What I want from haproxy is to notice that there are no back-end servers (he knows, because there are failed health checks) and do not accept TCP connections at all.Bartosz Bilicki

1 Answers

1
votes

I don't think what you are looking for is possible. HAproxy handles the two sides of the connection (frontend, backend) separately. The incoming TCP connection is established first and then HAproxy looks for a matching destination for it.