Amazon ECS 中的最小健康百分比和最大百分比是多少 [英] What is the minimum healthy percent and maximum percent in Amazon ECS

查看:48
本文介绍了Amazon ECS 中的最小健康百分比和最大百分比是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有使用 Docker 和 EC2 的经验.但我是 ECS 的新手.有人能帮我理解这两个参数的实际作用,它们的区别和用法.

I already have the experience in Docker and EC2. But I'm new to ECS. Can someone help me to understand what these two parameters actually does, their difference and usage.

官方文档 说:

最低健康百分比表示在部署期间必须保持在 RUNNING 状态的服务任务数量的下限,作为所需任务数量的百分比(向上取整到最接近的整数).此参数使您能够在不使用额外集群容量的情况下进行部署.例如,如果您的服务具有所需的四个任务数量和 50% 的最低健康百分比,则调度程序可能会在启动两个新任务之前停止两个现有任务以释放集群容量.不使用负载均衡器的服务任务如果处于 RUNNING 状态,则被认为是健康的;如果使用负载均衡器的服务的任务处于 RUNNING 状态,并且负载均衡器将托管它的容器实例报告为健康,则它们被认为是健康的.控制台中的最小健康百分比的默认值为 50%,AWS CLI、AWS 开发工具包和 API 的默认值为 100%.

The minimum healthy percent represents a lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desired number of tasks (rounded up to the nearest integer). This parameter enables you to deploy without using additional cluster capacity. For example, if your service has a desired number of four tasks and a minimum healthy percent of 50%, the scheduler may stop two existing tasks to free up cluster capacity before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state; tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance it is hosted on is reported as healthy by the load balancer. The default value for minimum healthy percent is 50% in the console and 100% for the AWS CLI, the AWS SDKs, and the APIs.

ma​​ximum percent 参数表示在部署期间允许处于 RUNNING 或 PENDING 状态的服务任务数量的上限,作为所需任务数量的百分比(向下取整到最接近的整数).此参数使您能够定义部署批处理大小.例如,如果您的服务具有所需的四个任务数量且最大百分比值为 200%,则调度程序可能会在停止四个旧任务之前启动四个新任务(前提是执行此操作所需的集群资源可用).最大百分比的默认值为 200%.

The maximum percent parameter represents an upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desired number of tasks (rounded down to the nearest integer). This parameter enables you to define the deployment batch size. For example, if your service has a desired number of four tasks and a maximum percent value of 200%, the scheduler may start four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximum percent is 200%.

这两个参数我还是没搞清楚.

I still didn't get a clear idea about these two parameters.

  1. 在最低运行状况百分比下,如果我的服务具有所需数量的 4 个任务和 25% 的最低运行状况百分比,调度程序将启动/停止多少现有/新任务?
  2. 对于最大百分比,如果我的服务具有所需数量的 4 个任务且最大百分比值为 50%,那么调度程序将启动/停止多少现有/新任务?
  3. 如果我的服务只有一个任务在运行,如何设置这些参数来停止现有任务并运行新任务.

推荐答案

  1. 当所需任务为 4 且最低运行状况为 25% 时,在部署期间,ECS 可以在开始新任务之前停止除 1 之外的所有任务
  2. 最大值应该是 100+,这样配置就没有意义了.但是,如果您有 4 个所需的任务并且最大值为 150%,那么 ECS 可以在停止其他任务之前启动 2 个新任务.
    • 如果您想确保在重新部署期间运行的任务永远不会超过 1 个,那么您需要将所需设置为 1,最小设置为 0%,最大设置为 100%.
    • 如果您想确保始终至少有 1 个任务在运行,您需要将所需设置为 1,最小设置为 100%,最大设置为 200%.

其他例子.如果您想要 4,则最低为 50%,最高为 150%.然后 ECS 可以决定它在部署期间将做什么.

Other example. If you have desired at 4, minimum at 50% and maximum of 150%. Then ECS can decide what it will do during deployment.

  • 如果集群没有更多资源,它可以决定停止 2 个任务,在新版本中启动 2 个新任务,等待新任务健康.然后停止剩下的两个任务并开始两个新的任务.
  • 如果集群有更多资源,那么 ECS 可以决定在停止现有任务之前启动两个新任务.

或者你可以这样看.在重新部署期间,ECS 需要在 MinimumPercent/100*desired 和 MaximumPercent/100*desired 任务之间运行.在这种情况下,有 2-6 个任务.

Or you could look at it this way. During redeployment ECS needs to run between MinimumPercent/100*desired and MaximumPercent/100*desired tasks. In this case between 2-6 tasks.

这篇关于Amazon ECS 中的最小健康百分比和最大百分比是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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