gpt4 book ai didi

javascript - AWS AutoScaling Down 策略在扩展成功后失败 : Failed to execute autoscaling action: No step adjustment found for metric value

转载 作者:行者123 更新时间:2023-12-05 02:00:50 24 4
gpt4 key购买 nike

在 Terraform v13 中创建自动缩放策略和 cloudwatch 警报资源时,它们创建得很好。但是,在对端点进行负载测试时,他们成功地扩展了实例,但是当 CPU 利用率在一段时间内达到必要的百分比时却无法缩减。错误看起来像这样:

“historySummary”:“无法执行 AutoScaling 操作:未找到指标值 [5.99763732496649、2.7634547331059975] 和违规增量 -4.00236267503351 的步长调整”

下面列出了 terraform 资源:

自动缩放策略 -

resource "aws_appautoscaling_policy" "frontend_down" {
name = "${var.name}_frontend_scale_down"
service_namespace = "ecs"
resource_id = "service/${aws_ecs_cluster.main.name}/${aws_ecs_service.frontend.name}"
scalable_dimension = "ecs:service:DesiredCount"

step_scaling_policy_configuration {
adjustment_type = "ChangeInCapacity"
cooldown = 30
metric_aggregation_type = "Maximum"

step_adjustment {
metric_interval_lower_bound = 0
scaling_adjustment = -1
}
}

depends_on = [aws_appautoscaling_target.frontend_target]
}

Cloudwatch 警报 -

resource "aws_cloudwatch_metric_alarm" "frontend_service_cpu_low" {
alarm_name = "${var.name}_cpu_utilization_low_fe"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/ECS"
period = "60"
statistic = "Average"
threshold = "10"

dimensions = {
ClusterName = var.ecs_cluster_name
ServiceName = var.ecs_service_name_frontend
}

alarm_actions = [var.autoscaling_down_arn_frontend]

tags = {
Name = "${var.name}-autoscaling"
BillingCode = var.billing_code_tag
Environment = var.environment_tag
}
}

最佳答案

找出原因,这是因为在缩减策略时我使用的是“metric_interval_lower_bound”而不是“metric_interval_upper_bound”。当按比例缩小时,与警报阈值和 cloudwatch 指标相比,它会提供一个负增量,因此 0 成为上限。放大时,您使用下限,因为它提供正增量

关于javascript - AWS AutoScaling Down 策略在扩展成功后失败 : Failed to execute autoscaling action: No step adjustment found for metric value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66999238/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com