社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
利用nginx+tomcat配置负载均衡,配了两台tomcat,直接访问tomcat速度是很快的,但是配置完后访问速度变得很慢,然后查看了nginx的错误日志:
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: 183.128.230.122, server: www.xxx.com, request: “POST /ytx/web/check/tasklistJson HTTP/1.1”, upstream: “http://120.27.203.130:8083/ytx/web/check/tasklistJson”, host: “www.xxx.com”, referrer: “http://www.xxx.com/ytx/web/home/checkTask”
下面是我主要的配置:
网上查了资料,有说把upstream里的sever注释掉一个,我试了下,访问是正常了,但这就不是负载均衡了,这个方法不可取。然后试了另一种方法,在upstream里加上ip_hash,然后访问就正常了。
本人菜鸟,也不知道这是什么原因,有大佬指点一下吗
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!