tomcat - HAProxy - 传输期间连接重置

标签 tomcat haproxy high-availability

我在部署在 tomcat 中的 2 个 Web 应用程序前使用 HAProxy。在测试高可用性时,我发出了 10000 个请求,并在某个时候杀死了一个 tomcat 实例。对于 1 或 2 个请求,我收到一些错误。我的请求是使用 Spring 的 RestTemplate 发送的。这是异常(exception): “org.springframework.web.client.ResourceAccessException:“http://:8080/myservice/_doaction”的 POST 请求中的 I/O 错误:来自服务器的文件意外结束;嵌套异常是 java.net.SocketException:意外结束来自服务器的文件”

HAProxy 统计数据在“错误”部分的“响应”小节中显示,当我将鼠标悬停在此处显示的数字上时,即 2:“传输期间连接重置:1 个客户端,2 个服务器”。这是什么意思?

此外,在“警告”部分我有“Retr”:29 和“Redis”:1。这告诉我请求正在重新发送到“事件”服务器。这个假设是否正确?

这是 haproxy.cfg:

listen tomcat_frontend 
bind *:8080
timeout client 5000ms
timeout server 5000ms
mode http
option httpclose
option httplog
acl myservice_tomcat path_beg /myservice
use_backend tomcat_myservice_backend if myservice_tomcat
backend tomcat_myservice_backend
option forwardfor
option redispatch
retries 30
server server-2 :8080 check inter 10
server server-1 :8080 check inter 10
balance leastconn
mode http

最佳答案

非常古老的问题,但是“retr”错误的热门搜索结果之一。每个 CSV 的一些信息 docs ('w' 前缀表示警告,'e' 表示错误):

eresp [..BS]: response errors. srv_abrt will be counted here also.
     Some other errors are:
     - write error on the client socket (won't be counted for the server stat)
     - failure applying filters to the response.
wretr [..BS]: number of times a connection to a server was retried.
wredis [..BS]: number of times a request was redispatched to another
     server. The server value counts the number of times that server was
     switched away from.

关于tomcat - HAProxy - 传输期间连接重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27245298/

相关文章:

java - 将请求参数放入其他变量是最佳做法吗?

tomcat - 尝试使用智能卡向 Tomcat 进行身份验证

tomcat - 无法在debian上启动tomcat5.5

java - 如何使用java编程访问HAProxy

http - 存储和转发带有重试的 HTTP 请求?

kubernetes - 无法检查 ETCD 集群运行状况

tomcat - 使用 Azure ADFS 的 tomcat 托管 Web 应用程序的 SSO

docker-compose 比例不适用于 haproxy

performance - haproxy:它有什么用途?

linux - Logstash高可用部署