mesosphere / marathon-lb

Marathon-lb is a service discovery & load balancing tool for DC/OS
Apache License 2.0
449 stars 300 forks source link

When using --haproxy-map, if the domain name of the two services is the same, then only one service can be accessed #458

Open ccywei opened 7 years ago

ccywei commented 7 years ago

I have deployed two servers, serverA and serverB, Their labels are shown on marathon as follows: serverA: HAPROXY_GROUP=internal HAPROXY_0_VHOST=marathon-lb-internal.marathon.mesos serverB: HAPROXY_GROUP=internal HAPROXY_0_VHOST=marathon-lb-internal.marathon.mesos

:9090/_haproxy_getappmap: /serverA serverA_10011 /serverB serverB_10026

:9090/_haproxy_getvhostmap: marathon-lb-internal.marathon.mesos serverA_10011 marathon-lb-internal.marathon.mesos serverB_10026

I can access the serverA but can't access serverB, why?

ajays20078 commented 7 years ago

That is how HAProxy works, you cannot route it to 2 different backends at the same time with the same vhost. Why would you even want to do that? HAProxy routes it to the backend which is sequentially first in the map file.

ccywei commented 7 years ago

Because I want these two services to be accessed through the 80 port of LB, then the domain name of LB is used when accessing, so Vhost is configured with the LB domain name