포트 9000과 9001에서 실행되는 2개의 springboot 애플리케이션이 있습니다. 또한 docker 컨테이너를 사용하여 HaProxy를 실행했습니다. 내 구성 파일은 다음과 같습니다.
global
defaults
mode http
timeout connect 5000ms
timeout client 5000ms
timeout server 5000ms
frontend http-in
bind *:80
acl has_web1 path_beg /web1
acl has_web2 path_beg /web2
use_backend web1 if has_web1
use_backend web2 if has_web2
default_backend web1
backend web1
server web1 127.0.0.1:9000 check
backend web2
server web2 127.0.0.1:9001 check
localhost/web1과 같은 URL에 액세스하려고 하면 오류 코드 503이 표시됩니다.
누군가 왜 이런지 말해 줄 수 있나요? 도커 작성 파일은 다음과 같습니다.
version: '3'
services:
#web1:
# image: dockercloud/hello-world
# container_name: web1
# ports:
# - "81:80"
#web2:
# image: dockercloud/hello-world
# container_name: web2
# ports:
# - "82:80"
haproxy:
build: ./haproxy
container_name: haproxy
ports:
- "80:80"
Dockerfile은 다음과 같습니다.
FROM haproxy:1.7
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
중요한 경우 저는 Windows에서 작업하고 있습니다.
편집: HaProxy 2.1.2 버전으로 전환했는데 다음과 같은 경고가 표시되었습니다.
gs:
haproxy | [NOTICE] 020/002817 (1) : New worker #1 (6) forked
haproxy | [WARNING] 020/002817 (6) : Server web1/web1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
haproxy | [ALERT] 020/002817 (6) : backend 'web1' has no server available!
haproxy | [WARNING] 020/002818 (6) : Server web2/web2 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
haproxy | [ALERT] 020/002818 (6) : backend 'web2' has no server available!
도커 컨테이너 때문인가요??