【发布时间】:2016-06-28 10:39:43
【问题描述】:
我正在使用带有 Docker Swarm 的 Azure 容器服务来托管一些容器。这些容器正在运行 ASP.NET Core Web API,并公开了一个私有端口。我正在尝试使用 Haproxy 作为这些容器前面的内部负载均衡器,而这些容器又通过 Azure 容器服务上的端口 8080 公开。
这里是 haproxy.cfg
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
chroot /usr/local/etc/haproxy
uid 99
gid 99
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:8080
default_backend servers
backend servers
server server1 10.0.0.4:8080 maxconn 32
server server1 10.0.0.5:8080 maxconn 32
server server1 10.0.0.6:8080 maxconn 32
【问题讨论】:
-
Docker 1.12 在引擎中内置了 Swarm,并带有内部负载均衡器。这是一个候选版本,但可能值得一试?