使用 Application Load Balancer 时无法将简单 HTTP 服务器部署到 ElasticBeanstalk
我无法将最简单的 docker-compose 文件部署到配置了应用程序负载均衡器以实现高可用性的 ElasticBeanstalk 环境。
这是 docker 文件:
version: "3.9"
services:
demo:
image: nginxdemos/hello
ports:
- "80:80"
restart: always
EB 事件链:
- 创建 CloudWatch 警报和日志组
- 创建安全组
- 对于负载均衡器
- 允许端口
80/443
上的来自互联网的传入流量到达我的两个侦听器
- 允许端口
- 对于 EC2 机器
- 允许传入流量从创建的第一个安全组流向
process
端口
- 允许传入流量从创建的第一个安全组流向
- 对于负载均衡器
- 自动扩展组
- 创建应用程序负载均衡器
- 创建EC2实例
大约。创建 EC2 实例 (#5) 10 分钟后,我收到以下日志:
环境健康状况已从“待处理”转变为“严重”。 ELB 进程并非在所有实例上都运行正常。正在进行初始化(运行 12 分钟)。没有实例正在发送数据。 50.0% 的 ELB 请求因 HTTP 5xx 失败。请求率(2.0 个请求/分钟)不足以确定应用程序运行状况(6 分钟前)。 ELB 运行状况出现故障或不适用于所有实例。
查看目标组
,它指示0 个健康实例(基于默认的运行状况检查)
当通过 SSH 连接实例时,我看到 docker 服务甚至没有启动,我的应用程序也没有运行。这就解释了为什么该实例
不健康
。
然而,我应该做些什么不同的事情呢?根据我的理解,对我来说,它看起来像是由 ElasticBealstalk 启动的流程中的错误,因为该流程在启动我的应用程序之前正在等待实例健康
(否则,为什么在创建 EC2 实例后 10 分钟内应用程序还没有启动?)
这看起来不像是应用程序问题,因为 docker 服务甚至没有启动。
感谢您的帮助。
I'm unable to deploy the simplest docker-compose
file to an ElasticBeanstalk environment configured with Application Load Balancer for high-availability.
This is the docker file:
version: "3.9"
services:
demo:
image: nginxdemos/hello
ports:
- "80:80"
restart: always
This is the ALB configuration:
EB Chain of events:
- Creating CloudWatch alarms and log groups
- Creating security groups
- For the load balancer
- Allow incoming traffic from the internet to my two
listerners
on ports80/443
- Allow incoming traffic from the internet to my two
- For the EC2 machines
- Allow incoming traffic to the
process
port from the first security group created
- Allow incoming traffic to the
- For the load balancer
- Create auto scaling groups
- Create Application Load Balancer
- Create EC2 instance
Approx. 10 minutes after creating the EC2 instance (#5), I get the following log:
Environment health has transitioned from Pending to Severe. ELB processes are not healthy on all instances. Initialization in progress (running for 12 minutes). None of the instances are sending data. 50.0 % of the requests to the ELB are failing with HTTP 5xx. Insufficient request rate (2.0 requests/min) to determine application health (6 minutes ago). ELB health is failing or not available for all instances.
Looking at the Target Group
, it is indicating 0 healthy instances (based on the default healthchecks)
When SSH'ing the instance, I see that the docker
service is not even started, and my application is not running. So that explains why the instance is unhealthy
.
However, what am I supposed to do differently? based on the understanding I have, to me it looks like a bug in the flow initiated by ElasticBealstalk, as the flow is waiting for the instances to be healthy
before starting my application (otherwise, why the application wasn't started in the 10 minutes after the EC2 instance was created?)
It doesn't seem like an application issue, because the docker
service was not even started.
Appreciate your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试使用您的
docker-compose.yml
和在 64 位 Amazon Linux 2/3.4.12 平台上运行的Docker 来复制您的问题。为了进行测试,我创建了一个仅包含 docker-compose.yml 的 zip 文件。
一切按预期工作,没有发现任何问题。
我唯一可以建议的是仔细检查你的文件。此外,没有理由使用 443,因为您根本没有 https。
I tried to replicate your issue using your
docker-compose.yml
andDocker running on 64bit Amazon Linux 2/3.4.12
platform. For the test I created a zip file containing only thedocker-compose.yml
.Everything works as expected and no issues were found.
The only thing I can suggest is to double check your files. Also there is no reason to use 443 as you don't have https at all.