我在同一EC2实例上有Apache Superset和Apache2服务器。 Apache2充当代理服务器。它接受HTTPS请求并将其传输到Apache Superset。 Apache Superset使用gunicorn
运行。
对Apache Dremio数据引擎的请求可能需要一些时间(<60秒)。当访问Superset上的仪表板时,使用带有SSL的DNS名称和代理设置,某些仪表板部件(请求)将失败,并显示以下错误:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request
Reason: Error reading from remote server
奇怪的是,尽管ProxyTimeout
的默认值很高,这些错误仍会在几秒钟内出现。
如果通过IP地址访问Superset,则不会发生此问题。
apache2/error.log
中的错误消息:
(20014) Internal error (specific information not available): [client 10.4.26.3:6969] AH01102: error reading status line from remote server localhost:8088, referer: ...
问题可能与代理服务器超时或Superset Web服务器断开某些连接有关。我的Apache2配置:
<VirtualHost *:443>
ProxyPreserveHost On
ProxyRequests Off
ServerName dash.domain.com
ServerAlias dash.domain.com
SSLEngine on
SSLCertificateFile /etc/ssl/private/cert.crt
SSLCertificateChainFile /etc/ssl/certs/cert2.crt
SSLCertificateKeyFile /etc/ssl/private/key.key
ProxyPass / http://localhost:8088/ connectiontimeout=3600 timeout=3600
ProxyPassReverse / http://localhost:8088/
# things tried
# SetEnv force-proxy-request-1.0 1
# SetEnv proxy-nokeepalive 1
# SetEnv proxy-initial-not-pooled 1
# ProxyTimeout 3600
# TimeOut 3600
</VirtualHost>
已测试(但无法正常工作)
Timeout
和ProxyTimeout
connectiontimeout
和timeout
(如上所示)Keepalive=On
for ProxyPass superset_config.py
-> ENABLE_PROXY_FIX,SUPERSET_WEBSERVER_TIMEOUT 此外,使用nginx
构建了类似的代理设置,错误类似于此处描述的内容。
任何帮助或想法将不胜感激。非常感谢!
Apache Superset版本: 0.37.2
Apache Dremio版本: 4.1.0
Apache2服务器版本: 2.4.29
EC2实例类型: t3.medium
操作系统版本: Ubuntu 18.04
答案 0 :(得分:1)
问题出在死于枪械 async 的工人上。图表中提出了太多请求,工作人员无法处理这些请求。将工作程序类型从异步更改为 sync (默认的枪鱼类型)可以解决代理问题。
我仍然不知道为什么通过IP直接访问没有产生502代理错误。
很抱歉,问题中未包含有关gunicorn
的信息。
P.S从他们的文档中推荐的Apache Superset工作者类型为 async ,但就我而言, sync 是更好的解决方案。从理论上讲,同步工作者比异步(在Superset上下文中)要慢。