要解决AWS ALB健康检查延迟问题,可以尝试在Target Group的健康检查设置中增加延迟时间。例如,以下的代码示例将Target Group的健康检查延迟设置为20秒:
resource "aws_lb_target_group" "example" {
name = "example"
port = 80
protocol = "HTTP"
target_type = "instance"
vpc_id = aws_vpc.example.id
health_check {
interval = 30
path = "/"
port = "traffic-port"
protocol = "HTTP"
timeout = 10
healthy_threshold = 3
unhealthy_threshold = 3
matcher = "200-399"
delay = 20
}
}
这将延迟每次健康检查的开始时间,以便等待实例完全启动并加载应用程序。在大多数情况下,适当的延迟时间可以减少健康检查失败的情况,从而提高负载均衡器的可用性。
上一篇:AWSALB健康检查失败。