HAProxy无法识别全部后端Docker应用副本问题求助
HAProxy无法识别全部后端Docker应用副本问题求助
大家好,我最近碰到个棘手的问题:我想用HAProxy代理10个Docker应用副本,但实际运行起来后,HAProxy好像只能识别到部分副本,不是全部。下面是我的配置和遇到的具体情况,麻烦各位帮忙排查下问题出在哪!
我的docker-compose.yml配置如下:
services: haproxy: image: haproxy:2.3-alpine volumes: - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg ports: - 8888:80 app: build: . command: perl app.pl init: true deploy: replicas: 10
对应的haproxy.cfg配置:
global maxconn 1024 listen in bind :80 server-template srv 10 app:8080 check timeout connect 5000ms timeout client 50000ms timeout server 50000ms
启动服务后,我从日志里能看到多个app副本已经正常就绪,但HAProxy并没有把所有10个副本都纳入后端代理。截取的部分启动日志如下:
$ docker compose up
...
app-3 | MyWebServer: You can connect to your server at http://localhost:8080/
haproxy-1 | [NOTICE] 094/155107 (1) : New worker #1 (8) forked
app-4 | MyWebServer: You can connect to your server at http://localhost:8080/
app-2 | MyWebServer: You can connect to your server at http://localhost:8080/
app-5 | MyWebServer: You can connect to your server...
备注:内容来源于stack exchange,提问作者x-yuri
相关产品推荐
相关产品推荐

