배포/ELB

healthcheck

베스트오버 2023. 6. 29. 09:29

로드밸런서에서 분명 request, response 등의 활동이 잘 되고 있는데도 healthy가 뜨지 않고 unhealty가 뜨는 것을 보고

 

from django.http import HttpResponse
from django.urls import path

def health_check(request):
    return HttpResponse("OK", content_type="text/plain")

urlpatterns = [
    path('healthcheck', health_check),
]

코드를 추가하고

 

로드 밸런서/설명/보기 및 수정/Health Check 설정에서

핑 대상을 /healthcheck로 수정

저장하고

1분 정도 있으니

 

해결이 되었다.

 

우선 기능은 작동이 되어 미뤄뒀던 health check를 해결하게 되어 기분이 좋다.