Nginx错误日志:no live upstreams while connecting to upstream xxx;
- 问题和现象:
- 近期有业务方反馈业务接口请求偶尔会返回502现象;
- 查看access.log日志中502请求个数:
- 全部接口统计过去一天502请求个数:7692,请求总数:376,178,782,502概率:0.002%;
- 查看nginx中的错误日志:nginx_log/error.log 搜关键词“no live upstreams”
-
发现类似报错:no live upstreams while connecting to upstream, client: xxxx, server:
-
-
问题分析:
-
根据超时接口名abc_service,找到对应的location,或者直接在nginx.conf中搜索关键词“proxy_read_timeout 800ms”;
-
通过该location下面的proxy_pass 找到对应的upstream;查看该upstream下面的server节点数和失败配置,默认配置为:max_fails=1 fail_timeout=10s
-
由于abc_service接口本身大于800ms超时请求较多,达到默认失败1次后,该server节点10s内不接受请求;当唯二的两个server都失败时,nginx进行quick recovery,把每个节点
-