Haproxy:如何在达到maxconn时主动重置客户端连接?

从文档:

maxconn <number> Sets the maximum per-process number of concurrent connections to <number>. It is equivalent to the command-line argument "-n". Proxies will stop accepting connections when this limit is reached. The "ulimit-n" parameter is automatically adjusted according to this value. See also "ulimit-n". Note: the "select" poller cannot reliably use more than 1024 file descriptors on some platforms. If your platform only supports select and reports "select FAILED" on startup, you need to reduce maxconn until it works (slightly below 500 in general). 

据我所知,当客户端尝试连接到代理和代理有maxconn连接,它将不会发送SYN + ACK包到客户端,所以客户端将最终超时。

我想让haproxy发送RST给客户端,如果达到了maxconn 。 可能吗?

这不是由haproxy控制的。 我认为它只设置监听套接字积压。 “等待”的东西是由操作系统完成的。 如果你想发送重置,你可能应该从操作系统的防火墙,使用连接跟踪器或什么的(在Linux中,限制使用iptables的特定端口的最大连接数)。