我的 Elastic Beanstalk 应用程序间歇性地没有响应,但我无法找出原因。发生了什么:
Mar 31 05:15:47 ip-172-31-28-174 systemd[1]: Starting [email protected] - Refresh policy routes for ens5...
Mar 31 05:15:47 ip-172-31-28-174 ec2net[2485]: Starting configuration for ens5
Mar 31 05:15:48 ip-172-31-28-174 systemd[1]: [email protected]: Deactivated successfully.
Mar 31 05:15:48 ip-172-31-28-174 systemd[1]: Finished [email protected] - Refresh policy routes for ens5.
Mar 31 05:15:48 ip-172-31-28-174 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=refresh-policy-routes@ens5 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 31 05:15:48 ip-172-31-28-174 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=refresh-policy-routes@ens5 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
另外,这是设置:
web: gunicorn main:app --workers=4 --worker-class=uvicorn.workers.UvicornWorker
可能是什么?是网络配置问题吗?负载均衡器?还是与应用环境有关?我还能够将代码部署到单实例 EBS 应用程序,并且没有出现停机问题。我无法在该实例上轻松获取 https,因此我无法确定问题是否出在负载均衡器级别。
我能够弄清楚这里发生了什么。
流量本质上被路由到私有子网,该子网将流量映射到 NAT 网关而不是 Internet 网关。由于有两个实例正在运行,因此仅有时会将请求发送到连接到有问题的子网的实例。为了解决这个问题,我更新了默认子网以指向路由表上的互联网网关。 (入站流量 0.0.0.0 -> IGN)。我这样做是因为我无法轻松更改 EBS 在从命令行启动时选择 VPC 和默认子网的方式。
导致这个问题的原因有很多,导致排查困难。需要明确的是: