On Mon, Jan 21, 2013 at 7:30 PM, Sölvi Páll Ásgeirsson <[email protected]> wrote:
> Hello!
>
> I have a small question on 'idiomatic' haproxy configuration, when
> serving multiple independent applications from
> a a shared group of webservers and if I should define each
> application/virtual directory as a dedicated backend or not.
> I apologize if I'm missing something obvious from the documentation.

No reason to choose one or the other ;-). I run two web applications
on the same group of servers, however, each application has a
dedicated backend that defines the same servers, there are individual
checks for each application, allowing them to have different statuses.

--
frontend vip00
    mode http
    bind 0.0.0.0:80

    acl is-apptwo dst 172.16.1.102

    use_backend apptwo if is-fileac
    default_backend appone

backend appone
    mode http
    option httplog
    option httpchk GET / HTTP/1.1\r\nHost:\ www
    option http-server-close

    balance roundrobin

    server http00 http00:80 check inter 2s
    server http01 http01:80 check inter 2s
    server localhost 127.0.0.1:8888 check inter 2s backup


backend apptwo
    mode http
    option httplog
    option httpchk GET /robots.txt
    option http-server-close

    balance roundrobin

    server http00 http00:81 check inter 2s
    server http01 http01:81 check inter 2s
    server localhost 127.0.0.1:8888 check inter 2s backup
--

I used different ports, but you could easily use the same server/port
for each backend. The frontend uses an acl to sort out the backend,
for my set-up I have a specific IP address for each app. You may very
well use host headers etc. for your acls. The third server in each
backend is a "sorry, we are down" page that is displayed only if all
other servers in the backend are down.

Reply via email to