nginx network_error ai_generated true

连接上游时没有可用的上游服务器

no live upstreams while connecting to upstream

ID: nginx/no-live-upstreams-while-connecting-to-upstream

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
nginx 1.24.0 active — — —
nginx 1.22.1 active — — —
nginx 1.26.0 active — — —

根因分析

upstream块中的所有上游服务器均被标记为故障或健康检查失败,导致没有可用目标。

English

All upstream servers in the upstream block are marked as down or have failed health checks, leaving no available targets.

generic

官方文档

https://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream

解决方案

  1. Check upstream server health and restart them: systemctl restart myapp. Also verify health_check settings in nginx.conf and ensure backup servers are defined: server backup1.example.com backup;
  2. Temporarily mark a server as up with max_fails=0 fail_timeout=0 in the upstream block: server 10.0.0.1:8080 max_fails=0 fail_timeout=0;

无效尝试

常见但无效的做法:

  1. Increase worker_connections to 10240 95% 失败

    This error is about upstream availability, not connection limits. Increasing worker_connections cannot revive dead upstream servers.

  2. Set proxy_next_upstream to always retry 85% 失败

    proxy_next_upstream only works if there is at least one live upstream. If all are dead, retry logic is useless.