ELB健康检查失败

ELB health check failing

an instance was taken out of service in response to a ELB system health check failure.

我用浏览器访问了运行状况检查端点,它 returns 正常,但我收到了上述消息。

我该如何调试它?

我查看了 instant settings => Get System Logs 和 nginx 日志,

nginx 有

- [27/Mar/2020:05:35:42 +0000] "GET /littlehome/heartbeat/ HTTP/1.1" 200 2 2.920 2.920 "-" "ELB-HealthChecker/2.0" - [27/Mar/2020:05:35:42 +0000] "GET /littlehome/heartbeat/ HTTP/1.1" 200 2 2.858 2.856 "-" "ELB-HealthChecker/2.0"

肯定返回了 200..

仍然认为它收到了 502

{
    "Target": {
        "Id": "i-085e8dffe8781f876",
        "Port": 80
    },
    "HealthCheckPort": "80",
    "TargetHealth": {
        "State": "unhealthy",
        "Reason": "Target.ResponseCodeMismatch",
        "Description": "Health checks failed with these codes: [502]"
    }
},

根据评论,问题是 Auto Scaling 组中的 grace period 太短了。解决方案是增加它。