Hi Nathan,

Actually, if both services are hosted on the same servers, my
configuration should work.
And from your configuration example, this is what I understood
(servers have same name in your second configuration).

Anyway, happy to have helped you :)

Baptiste

On Wed, Apr 23, 2014 at 12:56 AM, Nathan Reilly <[email protected]> wrote:
> Hi baptiste,
>
> I think the requirements have been confused, the services are separate, but 
> must fail together, if that makes sense, don't worry, it has taken me weeks 
> to get the requirements clear from the project, but traffic to port 80 comes 
> from an external source, and traffic to port 8080 is from an internal service 
> bus. In any case, the config works as expected (until the project comes up 
> with a new requirement), I've taken your advice on the tcp-check on board and 
> will amend the config.
>
> Thanks again for your help.
>
> Nathan
>
> Sent from my iPhone
>
>> On 23 Apr 2014, at 2:19 am, Baptiste <[email protected]> wrote:
>>
>> Hi Nathan,
>>
>> There might be a mistake in your configuration.
>> Since you configured a port on the server directive line, then HAProxy
>> will forward all the traffic to this port, whatever the incoming port
>> was.
>> I doubt this is what you want.
>>
>> Second, both backends are using sitck table from the other backend...
>> So you don't have the same persistence for each service.
>> Better having one stick table in a backend and point to it from the
>> other backend.
>>
>> Third, the tcp-check does not work like this.
>>
>> Here is how I would do your configuration:
>>
>> frontend servername:80
>>    bind servername:80
>>    bind servername:8080
>>    default_backend server
>>
>> backend server
>>    option tcp-check
>>    tcp-check connect port 80
>>    tcp-check connect port 8080
>>    stick-table type ip size 1
>>    stick on dst
>>    server server-01-ext server01 check inter 5000
>>    server server-02-ext server02 check inter 5000
>>
>>
>> Baptiste
>>
>>
>>> On Tue, Apr 22, 2014 at 1:22 PM, Nathan Reilly <[email protected]> wrote:
>>> Hi Baptiste,
>>>
>>> You put me in the right track, I had over-complicated my config, here is the
>>> working config for anyone who's interested:
>>>
>>> frontend servername:80
>>>    bind servername:80
>>>    bind servername:8080
>>>    acl int dst_port 8080
>>>    acl ext dst_port 80
>>>    use_backend server-int if int
>>>    use_backend server-ext if ext
>>>    default_backend server-ext
>>>
>>> backend server-ext
>>>    option tcp-check port 80
>>>    option tcp-check port 8080
>>>    stick-table type ip size 1
>>>    stick match dst table server-int
>>>    stick on dst
>>>    server server-01-ext server01:80 check inter 5000
>>>    server server-02-ext server02:80 check inter 5000
>>>
>>> backend server-int
>>>    option tcp-check port 80
>>>    option tcp-check port 8080
>>>    stick-table type ip size 1
>>>    stick match dst table server-ext
>>>    stick on dst
>>>    server server-01-int server01:8080 check inter 5000
>>>    server server-02-int server02:8080 check inter 5000
>>>
>>> Thanks for your help, it's truly appreciated.
>>>
>>> Cheers,
>>> Nathan
>>>
>>>
>>>> On Mon, Apr 21, 2014 at 2:07 PM, Baptiste <[email protected]> wrote:
>>>>
>>>> Hi Nathan,
>>>>
>>>> Why not simply using a single frontend with two binds pointing to one
>>>> backend?
>>>> It would do the trick.
>>>> Concerning checking, you can use the tcp-check feature to ensure both
>>>> ports are available on each server.
>>>>
>>>> Baptiste
>>>>
>>>> On Mon, Apr 21, 2014 at 1:20 PM, Nathan Reilly <[email protected]>
>>>> wrote:
>>>>> Hello all,
>>>>>
>>>>> I have a situation that I have been trying to get working for days, yet
>>>>> can't seem to get there. There are two sets of requirements, I can get
>>>>> either requirements working in isolation, but not together.
>>>>> First requirement is I need an active/passive failover pair, and in the
>>>>> case
>>>>> of failure of one server, connections must stick to the available server
>>>>> until it fails, so if connections are initially to server1, then it
>>>>> fails,
>>>>> all connections go to server2, even when server1 comes back online,
>>>>> server2
>>>>> must keep servicing requests until it fails, and so on.
>>>>>
>>>>>
>>>>> Second requirement is that I have two backend servers, each with two
>>>>> 'services'. These services are linked, so if either service goes down,
>>>>> the
>>>>> entire server must be marked as down.
>>>>>
>>>>> See config so far below,
>>>>>
>>>>> frontend ext servername:80
>>>>>    acl server-01-down nbsrv(server-01) lt 2
>>>>>    acl server-02-down nbsrv(server-02) lt 2
>>>>>    use_backend server-ext-01 if server-02-down
>>>>>    use_backend server-ext-02 if server-01-down
>>>>>    default_backend server-ext-01
>>>>>
>>>>> frontend int servername:8080
>>>>>    stick-table type ip size 1 expire 5d
>>>>>    stick on dst
>>>>>    acl server-01-down nbsrv(server-01) lt 2
>>>>>    acl server-02-down nbsrv(server-02) lt 2
>>>>>    use_backend server-esb-01 if server-02-down
>>>>>    use_backend server-esb-02 if server-01-down
>>>>>    default_backend server-esb-01
>>>>>
>>>>> backend server-01
>>>>>    server server-01-ext server01-ext:80 check inter 5000
>>>>>    server server-02-int server01-int:8080 check inter 5000
>>>>>
>>>>> backend server-02
>>>>>    server server-02-ext server02-ext:80 check inter 5000
>>>>>    server server-02-int server02-int:8080 check inter 5000
>>>>>
>>>>> backend server-ext-01
>>>>>    stick-table type ip size 1 expire 5d
>>>>>    stick on dst
>>>>>    server server-01-ext server01-ext:80 check inter 5000
>>>>>
>>>>> backend server-ext-02
>>>>>    stick-table type ip size 1 expire 5d
>>>>>    stick on dst
>>>>>    server server-02-ext server02-ext:80 check inter 5000
>>>>>
>>>>> backend server-int-01
>>>>>    stick-table type ip size 1 expire 5d
>>>>>    stick on dst
>>>>>    server server-01-int server01-int:8080 check inter 5000
>>>>>
>>>>> backend server-int-02
>>>>>    stick-table type ip size 1 expire 5d
>>>>>    stick on dst
>>>>>    server server-02-int server02-int:8080 check inter 5000
>>>>>
>>>>> Any assistance or recommendations would be greatly appreciated,
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Nathan
>>>
>>>

Reply via email to