简体   繁体   English

AWS Elastic Beanstalk Rails app自动缩放问题

[英]AWS Elastic Beanstalk Rails app autoscaling issues

I'm running into two distinct, but related, issues with a Rails app (Ruby 1.9.3) I have deployed on AWS' Elastic Beanstalk. 我在AWS的Elastic Beanstalk上部署了一个Rails应用程序(Ruby 1.9.3),遇到了两个截然不同但相关的问题。 I have the following autoscaling config applied. 我应用了以下自动缩放配置。 I believe it is the default. 我相信这是默认的。

  • Environment type: Load balanced, auto scaling 环境类型:负载平衡,自动缩放
  • Number instances: 1 - 4 数字实例:1 - 4
  • Scale based on Average network out 基于平均网络输出进行扩展
  • Add instance when > 6000000 > 6000000时添加实例
  • Remove instance when < 2000000 <2000000时删除实例

Issue #1 - My app doesn't get very much traffic yet and only requires 1 EC2 instance (m1.medium). 问题#1 - 我的应用程序尚未获得大量流量,只需要1个EC2实例(m1.medium)。 I get several "ElasticBeanstalk Default Scale Down alarm" emails from AWS each week. 我每周都会从AWS收到几封“ElasticBeanstalk Default Scale Down alarm”电子邮件。 Most of the time, I check my app after receiving one, and it's fine; 大多数时候,我收到一个后检查我的应用程序,这很好; however, about once a month, I check my app after receiving the email and find the nginx 404 page. 然而,大约每月一次,我收到电子邮件后检查我的应用程序,并找到nginx 404页面。 EB has terminated my EC2 instance - the only one running my app - and generated a new one. EB终止了我的EC2实例 - 唯一运行我的应用程序的实例 - 并生成了一个新实例。 Why is it scaling down from 1 to 0? 为什么它从1缩小到0? This has happened to me with consistency for the past 6 months. 在过去的6个月里,我发现这种情况一致。 Has anyone else experienced this? 还有其他人经历过这个吗? Found a solution? 找到了解决方案?

Issue #2 - When the above situation happens, EB creates a new EC2 instance for me. 问题#2 - 当上述情况发生时,EB为我创建了一个新的EC2实例。 But, I continue to get the nginx 404 page until I re-deploy - which is a manual task and seems to defeat the purpose of auto scaling. 但是,我继续获得nginx 404页面,直到我重新部署 - 这是一个手动任务,似乎无法实现自动缩放的目的。 Does EB require a re-deploy after autoscaling occurs? 在自动缩放发生后,EB是否需要重新部署? Shouldn't it automatically deploy the current/latest version of my app to the new EC2 instance(s)? 它不应该自动将我的应用程序的当前/最新版本部署到新的EC2实例吗?

Any help/advice is greatly appreciated! 非常感谢任何帮助/建议!

I've had exactly this issue! 我有这个问题! The problem is that the Remove instance when < 2000000 criteria is firing when you only have one instance. 问题是当您只有一个实例Remove instance when < 2000000条件被触发时, Remove instance when < 2000000实例。 If your instance goes above 2000000 and then back down below 2000000, EB will terminate it and launch another one. 如果您的实例超过2000000然后降回2000000以下,EB将终止它并启动另一个。 Disable the autoscaling action for that alarm and your problem will go away. 禁用该警报的自动缩放操作,您的问题就会消失。

With regards to your second issue - how long are you waiting for the newly built instance to become available? 关于你的第二个问题 - 你等待新建的实例有多长时间了? I have noticed that new instances will be added to the autoscaling group as soon as they are ready, but before EB has finished deploying your application. 我注意到,新的实例将在准备好后立即添加到自动扩展组,但在EB完成部署应用程序之前。 In your single-instance situation, that's especially bad since there are no valid servers for a few minutes. 在您的单实例情况下,由于几分钟内没有有效的服务器,因此尤其糟糕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM