【发布时间】:2019-12-04 13:17:48
【问题描述】:
我有一个使用弹簧执行器的弹簧启动应用程序,并且在路径下: localhost:8080/my-app/health 正常时返回:
{
"status":"UP"
}
如果不是:
{
"status":"DOWN"
}
我希望 ECS 在状态多次关闭时重新启动容器。我将 jq 添加到容器定义中,还在任务定义中添加了运行状况检查:
...
"healthCheck": {
"retries": 10,
"command": [
"CMD-SHELL",
"[[ $(curl -s 'http://localhost:8080/my-app/health' | jq -r '.status') == \"UP\" ]] && exit 0 || exit 1 "
],
"timeout": 5,
"interval": 60,
"startPeriod": 300
}
...
但是 ECS 不断重启我的服务。谁能帮我说说如何创建这样的健康检查?
【问题讨论】:
标签: spring amazon-ecs spring-boot-actuator