AWS自动扩展ELB状态检查宽限期 [英] AWS autoscale ELB status checks grace period

查看:244
本文介绍了AWS自动扩展ELB状态检查宽限期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在AWS自动扩展组中运行服务器.正在运行的服务器位于负载均衡器的后面.我正在使用ELB来管理自动缩放组的运行状况检查.启动服务器并加入自动伸缩组后,它们当前将立即加入负载均衡器.

I'm running servers in a AWS auto scale group. The running servers are behind a load balancer. I'm using the ELB to mange the auto scaling groups healthchecks. When servers are been started and join the auto scale group they are currently immediately join to the load balancer.

我需要等多少时间(即运行状况检查宽限期),才能让它们加入负载均衡器?

How much time (i.e. the healthcheck grace period) do I need to wait until I let them join to the load balancer?

是否只有在服务器处于运行状态之后?

Should it be only after the servers are in a state of running?

是否只有在服务器通过系统并且实例状态检查之后?

Should it be only after the servers passed the system and the instance status checks?

推荐答案

Auto Scaling组有两种类型的运行状况检查:

There are two types of Health Check available for Auto Scaling groups:

  • EC2健康检查::此检查使用
  • EC2 Health Check: This uses the EC2 status check to determine whether the instance is healthy. It only operates at the hypervisor level and cannot see the health of an application running on an instance.
  • Elastic Load Balancer (ELB) Health Check: This causes the Auto Scaling group to delegate the health check to the Elastic Load Balancer, which is capable of checking a specific HTTP(S) URL. This means it can check that an application is correctly running on an instance.

鉴于您的系统正在使用ELB运行状况检查,Auto Scaling在确定每个EC2实例的运行状况时将信任ELB运行状况检查的结果.这可能会有些危险,因为如果实例需要一段时间才能启动,则运行状况检查可能会将实例错误地标记为不正常".反过来,这将导致Auto Scaling终止实例并启动替换.

Given that your system is using an ELB health check, Auto Scaling will trust the results of the ELB health check when determining the health of each EC2 instance. This can be slightly dangerous because, if the instance takes a while to start, the health check could incorrectly mark the instance as Unhealthy. This, in turn, would cause Auto Scaling to terminate the instance and launch a replacement.

为避免这种情况,Auto Scaling组配置中有一个运行状况检查宽限期设置(以秒为单位).这表明Auto Scaling在开始使用ELB运行状况检查之前应该等待多长时间(而后者又具有将实例检查频率标记为健康"/不健康"的检查频率和需要进行多少次检查的设置).

To avoid this situation, there is a Health Check Grace Period setting (in seconds) in the Auto Scaling group configuration. This indicates how long Auto Scaling should wait until it starts using the ELB health check (which, in turn, has settings for how often to check and how many checks are required to mark an instance as Healthy/Unhealthy).

因此,如果您的应用程序需要3分钟才能启动,请将运行状况检查宽限期设置为至少180秒(3分钟).该文档没有说明计时是从实例被标记为正在运行"那一刻开始还是从状态检查完成时开始,因此执行一些计时测试以避免任何弹跳"情况

So, if your application takes 3 minutes to start, set the Health Check Grace Period to a minimum of 180 seconds (3 minutes). The documentation does not state whether the timing starts from the moment that an instance is marked as "Running" or whether it is when the Status Checks complete, so perform some timing tests to avoid any "bounce" situations.

实际上,我建议将健康检查宽限期"设置为更高的值(例如,将所需时间加倍).这不会影响系统的运行,因为运行状况良好的实例将在满足ELB运行状况检查后立即开始服务流量,而该检查要早于Auto Scaling宽限期.最糟糕的情况是,一个真正不健康的实例将在几分钟后终止,但这应该很少发生.

In fact, I would recommend setting the Health Check Grace Period to a significantly higher value (eg double the amount of time required). This will not impact the operation of your system since a Healthy Instance will start serving traffic as soon as the ELB Health Check is satisfied, which sooner than the Auto Scaling grace period. The worst case is that a genuinely unhealthy instance will be terminated a few minutes later, but this should be a rare occurrence.

这篇关于AWS自动扩展ELB状态检查宽限期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆