백엔드가 작동하는 동안 동일한 요청이 있는 HAProxy가 때때로 NOSRV로 응답함

백엔드가 작동하는 동안 동일한 요청이 있는 HAProxy가 때때로 NOSRV로 응답함

haproxy에 동일한 요청(POST /user/oauth)을 하고 있지만 때로는 503이 표시되고 백엔드로 직접 요청을 보내는 것은 항상 작동합니다.

로그는 다음과 같습니다.

  1. local_server~ app/s2 0/0/0/100/100 200 813 - - --VN 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  2. local_server~ app/s1 0/0/1/107/108 200 820 - - --NI 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  3. local_server~ app/NOSRV 0/-1/-1/-1/0 503 216 - - SCNN 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  4. local_server~ app/NOSRV 0/-1/-1/-1/0 503 216 - - SCNN 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  5. local_server~ app/s2 0/0/1/106/107 200 831 - - --NI 2/2/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  6. local_server~ app/s1 0/0/1/3/6206 101 337 - - --NI 3/3/1/1/0 0/0 "GET / HTTP/1.1"
  7. local_server~ app/s1 0/0/1/83/84 200 258 - - --VN 2/2/0/0/0 0/0 "POST /transaction/concludeTransaction HTTP/1.1"
  8. local_server~ app/NOSRV 0/-1/-1/-1/0 503 216 - - SCNN 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"
  9. local_server~ app/s2 0/0/1/107/108 200 831 - - --NI 1/1/0/0/0 0/0 "POST /user/oauth HTTP/1.1"

보시다시피 POST /user/oauth는 때때로 s1로 이동하고 때로는 s2로 이동하고 때로는 NOSRV로 이동합니다.

10번 연속으로 통과할 때도 있고, 10번 연속 실패할 때도 있습니다.

내 구성은 다음과 같습니다.

defaults
log     global
mode    http
option  httplog
option  dontlognull
timeout connect 10000
timeout client  50000
timeout server  50000
retries 3
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

frontend local_server
bind *:8080 ssl crt /etc/letsencrypt/live/xxx/sslcert.pem
mode http
default_backend app

backend app
balance roundrobin
cookie SERVERID insert indirect nocache
http-send-name-header Host
server s1 172.26.13.134:3000 check cookie s1
server s2 172.26.13.134:3000 check cookie s2
http-request add-header X-Server %b

편집하다:

로컬 호스트에서 실행되는 빠른 Python 서버로 요청을 리디렉션했지만 여전히 문제가 지속됩니다. 그래서 서버 s1 127.0.0.1:8086 쿠키 s1만 확인하도록 haproxy 구성 파일을 편집했습니다.

python3 -m http.server 8086 --bind 127.0.0.1& Python 스크립트를 실행합니다.

내가 우체부로부터 연락을 받았을 때 나는 503보다 연속으로 3개의 succ를 받았습니다.

답변1

문제는 버전 내에 있다고 생각합니다. 버전 1.9가 2보다 더 잘 작동한다는 내용을 읽었습니다.* 소스 코드를 다운로드하고 다음 옵션으로 컴파일했습니다. make TARGET=linux-glibc USE_PCRE2=1 USE_PCRE2_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_REGPARAM=1 USE_SYSTEMD=1 USE_THREAD=1

보시다시피 apt-get install에서 얻는 옵션과의 유일한 차이점인 lua5 옵션을 일부러 생략했습니다.

결과 binay는 문제 없이 매우 잘 작동합니다.

관련 정보