nginx+tomcat负载均衡错误排查

本文详细解析了Nginx访问Tomcat时出现的六种常见错误,包括请求处理超时、连接被远程主机强制关闭、连接超时等,并提供了相应的错误代码和场景说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.tomcat能访问,但某个请求处理时间太长,超过30s,read超时,错误:

生效的配置【proxy_read_timeout 30s;】【tomcat的应答响应超过30s】

2019/04/03 12:07:46 [error] 17504#3308: *28 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /erp_new/s_test.jsp HTTP/1.1", upstream: "http://127.0.0.1:18080/erp_new/s_test.jsp", host: "localhost"

【10060+while reading response header from upstream】

 

2.nginx正访问一个tomcat时,关闭了这个tomcat,这时nginx会把消息转发给另外一个tomcat,同时报错误:

2019/04/03 16:46:03 [error] 17504#3308: *43 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /erp_new/s_test.jsp HTTP/1.1", upstream: "http://127.0.0.1:18080/erp_new/s_test.jsp", host: "localhost", referrer: "http://localhost/erp_new/s_test.jsp"

 

3.所有tomcat都关闭,会每个tomcat都访问一下,connect超时,错误:

生效的配置【proxy_connect_timeout 2s;】【2s后就返回这个错误,连接失败了】

2019/04/03 12:39:52 [error] 17504#3308: *38 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /erp_new/s_test.jsp HTTP/1.1", upstream: "http://127.0.0.1:28080/erp_new/s_test.jsp", host: "localhost"

【10060+while connecting to upstream】

 

4.如果每个tomcat都访问不了,还会再报一个错误:

2019/04/02 15:55:55 [error] 1606#0: *106592288 no live upstreams while connecting to upstream, client: 202.119.44.5, server: xxx.xxx.com, request: "GET / HTTP/1.1", upstream: "http://tomcat_new/", host: "xxx.xxx.com"

 

5.某个tomcat服务器网络访问不了,错误:

2019/04/02 15:56:24 [error] 1606#0: *106593488 connect() failed (113: No route to host) while connecting to upstream, client: 202.119.44.5, server: xxx.xxx.com, request: "GET /scripts/jquery/jquery.ui.datepicker-zh-CN.js HTTP/1.1", upstream: "http://xx.xx.xx.xx:9080/scripts/jquery/jquery.ui.datepicker-zh-CN.js", host: "xxx.xxx.com", referrer: "http://xxx.xxx.xxx/xxx/xxx.jsp"

 

6.tomcat的对应服务没有启动,或者网络负荷大丢包?错误:

2019/05/22 23:06:11 [error] 10223#0: *22167551 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: localhost, request: "GET / HTTP/1.1", upstream: "http://xx.xx.xx.xx:9080/", host: "xxx.xxx.com"

 

参考文档

https://blog.51cto.com/nanchunle/1657410

https://blog.51cto.com/xiaosu/1689992

https://blog.youkuaiyun.com/qq_29663071/article/details/80759098

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值