1

我有这个配置,用作两个 API(API_A 和 API_B)之间的负载平衡器。

<VirtualHost *:8080>

    # Cluster A
    ProxyPass "/services" "${API_A}/services" timeout=30
    ProxyPassReverse "/services" "${API_A}/services"

    # Cluster B (In the same PAAS)
    ProxyPass "/services" "${API_B}/services" retry=3 acquire=3000 timeout=5000 Keepalive=On
    ProxyPassReverse "/services" "${API_B}/services"

    # Configuration
    DocumentRoot "/opt/app-root/src/web"
    <Directory "/opt/app-root/src/web">
        AllowOverride FileInfo Indexes Options=Indexes,MultiViews
        Require all granted
    </Directory>

</VirtualHost>

API_A 部署在 IAAS 环境中。API_B 与此负载均衡器部署在同一 PAAS (Openshift) 中。许多调用因 http 代码错误502而失败,尤其是对于 API_B。对于每个失败的调用。我在日志中发现了这些代码错误。

AH01102: error reading status line from remote server API_B:80
AH00898: Error reading from remote server returned by /services/serviceB

我注意到调用失败时 API_B 没有收到任何 http 请求(我确信因为我登录所有服务的每个请求都有一个相关 ID)我已经尝试过这个配置[retry=3 acquire=3000 timeout =5000 保活=开]。我认为它降低了调用失败率(502 http 错误),尤其是retry=3,但我仍然有错误。我不明白为什么这些调用会失败,我该如何解决这个问题?

4

0 回答 0