[Proxy] Squid Proxy Health Check 설정

 

 

 

 

Squid Proxy 서버에 Squid Check 를 통하여 ALB 를 통해 헬스 체크를 할 수 있다.

 

 

 

squid-check 는 8080 으로 실행되며, squid 3128 으로 squid proxy 가 실행되고 있는 지 확인한다.

ALB 에서 squid-check 로 health check 요청을 보내면 squid-check 는 squid proxy 가 실행되고 있을 경우 200 을 응답하고, squid proxy 가 실행되고 있지 않을 경우 응답하지 않는다.

 

 

8080 포트 허용

 

vi /etc/squid/squid.conf

acl Safe_ports port 8080

 

 

로컬 요청 허용

http_access allow localhost to_localhost

 

 

squid-check 설치

# squid-check 다운로드
curl -L -o squid-check_Linux_x86_64.tar.gz https://github.com/persona-id/squid-check/releases/latest/download/squid-check_Linux_x86_64.tar.gz

# 압축해제
tar -xzvf squid-check_Linux_x86_64.tar.gz

# squid-check 실행파일 설정
cd squid-check_Linux_x86_64
chmod +x squid-check
cp squid-check /usr/local/bin/squid-check

 

 

squid-check daemon 설정

 

vi /etc/systemd/system/squid-check.service

[Unit]
Description=Check health of Squid by sending requests though it to a web server
After=syslog.target network.target remote-fs.target nss-lookup.target
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/bin/squid-check

[Install]
WantedBy=multi-user.target

 

 

squid-check 실행

systemctl enable --now squid-check

 

squid-check 가 8080 으로 실행되고 있는 지 확인한다.

 

 

 

/healthz 요청 시 응답 값

 curl http://localhost:8080/healthz

 

 

squid proxy 실행 중일 경우

success

 

 

squid proxy 미실행 중일 경우

curl: (52) Empty reply from server