如何在ECS服务上设置desiredCount?

时间:2020-05-16 12:17:00

标签: amazon-web-services amazon-ecs

我正在AWS ECS上运行EC2集群。

我这样启动服务:

tableView.resigterCells([Class1.self, Class2.self, Class3.self])

在我的ecs-cli compose -f docker-compose-base.yml -f docker-compose-prod.yml --ecs-profile root service up --create-log-groups文件中,我指定了ecs-params.yml

desiredCount: 2

但是,它始终总是获得默认的期望计数1:

version: 1
task_definition:
  services:
    api:
      desiredCount: 2

如何在不运行INFO[0000] Using ECS task definition TaskDefinition="api:5" WARN[0000] No log groups to create; no containers use 'awslogs' INFO[0016] (service api) has started 1 tasks: (task decf9405-63b1-4ddf-ba12-69018299e157). timestamp="2020-05-16 12:03:46 +0000 UTC" INFO[0077] Service status desiredCount=1 runningCount=1 serviceName=api 命令的情况下更改默认的所需计数?

1 个答案:

答案 0 :(得分:0)

是的,默认的期望计数为1。您将需要使用ecs-cli compose service scale此命令将服务的期望计数设置为指定的计数。这是完整的语法,其中n是所需的计数:

ecs-cli组成服务规模[-部署最大健康百分比n] [-部署最小健康百分比n] [-超时值] n [-帮助]

这是一个将所需计数设置为2的示例:

ecs-cli撰写--project-name hello-world --file hello-world.yml服务等级2

相关问题