Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Lukas Tribus
On Sat, 19 Feb 2022 at 18:38, Carlos Renato  wrote:
>
> Yes,
>
> In stats server2 is DOWN. accept the VM's network card.

Provide detailed logs please.


Lukas



Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Carlos Renato
Hi Lukas,

Excuse me.
It did work.

One detail was missing.

Thanks.

Em sáb., 19 de fev. de 2022 às 14:38, Carlos Renato 
escreveu:

> Yes,
>
> In stats server2 is DOWN. accept the VM's network card.
>
> Em sáb., 19 de fev. de 2022 às 13:32, Lukas Tribus 
> escreveu:
>
>> On Sat, 19 Feb 2022 at 16:15, Carlos Renato  wrote:
>> >
>> > Hi Lukas,
>> >
>> > Thanks for the reply and willingness to help.
>> >
>> > I did a test and it didn't work. I dropped the server2 interface and
>> only server1 was UP.
>> > Traffic continues to exit through the main bakend. My wish is that the
>> traffic is directed to the backup server.
>>
>> Did haproxy recognize server2 was down?
>>
>> With thgis configuration the backup keyword needs to be removed from
>> serverBKP (because the rule is implemented with a use_backend
>> directive), this was wrong in my earlier config.
>>
>>
>> Lukas
>>
>
>
> --
>
>
>

--


Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Carlos Renato
Yes,

In stats server2 is DOWN. accept the VM's network card.

Em sáb., 19 de fev. de 2022 às 13:32, Lukas Tribus  escreveu:

> On Sat, 19 Feb 2022 at 16:15, Carlos Renato  wrote:
> >
> > Hi Lukas,
> >
> > Thanks for the reply and willingness to help.
> >
> > I did a test and it didn't work. I dropped the server2 interface and
> only server1 was UP.
> > Traffic continues to exit through the main bakend. My wish is that the
> traffic is directed to the backup server.
>
> Did haproxy recognize server2 was down?
>
> With thgis configuration the backup keyword needs to be removed from
> serverBKP (because the rule is implemented with a use_backend
> directive), this was wrong in my earlier config.
>
>
> Lukas
>


--


Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Lukas Tribus
On Sat, 19 Feb 2022 at 16:15, Carlos Renato  wrote:
>
> Hi Lukas,
>
> Thanks for the reply and willingness to help.
>
> I did a test and it didn't work. I dropped the server2 interface and only 
> server1 was UP.
> Traffic continues to exit through the main bakend. My wish is that the 
> traffic is directed to the backup server.

Did haproxy recognize server2 was down?

With thgis configuration the backup keyword needs to be removed from
serverBKP (because the rule is implemented with a use_backend
directive), this was wrong in my earlier config.


Lukas



Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Carlos Renato
Hi Lukas,

Thanks for the reply and willingness to help.

I did a test and it didn't work. I dropped the server2 interface and only
server1 was UP.
Traffic continues to exit through the main bakend. My wish is that the
traffic is directed to the backup server.

Any tips?
Thank you very much.

Em sáb., 19 de fev. de 2022 às 10:48, Lukas Tribus  escreveu:

> Hello,
>
> I suggest you put your backup server in a dedicated backend and select
> it in the frontend. I guess the same could be done with use-server in
> a single backend, but I feel like this is cleaner:
>
>
>
> frontend haproxy
>   option forwardfor
>   bind server.lab.local:9191
>   use_backend backup_servers if { nbsrv(backend_servers) lt 2 }
>   default_backend backend_servers
>
> backend backend_servers
>   server server1 192.168.239.151:9090 check
>   server server2 192.168.239.152:9090 check
>
> backend backup_servers
>   server serverBKP 192.168.17.2:9090 backup
>
>
>
> Lukas
>
> On Sat, 19 Feb 2022 at 14:17, Carlos Renato  wrote:
> >
> > Can anyone help me?
> >
> > How to create an ACL to use the backup server if a server goes DOWN. So,
> if the two backend servers are UP, I use the registered servers. If one
> (only one) becomes unavailable, traffic is directed to the backup server.
> >
> > Below my settings.
> >
> > frontend haproxy
> >   option forwardfor
> >   bind server.lab.local:9191
> >   default_backend backend_servers
> >
> > backend backend_servers
> >   server server1 192.168.239.151:9090 check
> >   server server2 192.168.239.152:9090 check
> >   server serverBKP 192.168.17.2:9090 backup
> >
> > Thank you for your help
> >
> >
> >
> >
> > --
> >
> >
>


--


Re: ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Lukas Tribus
Hello,

I suggest you put your backup server in a dedicated backend and select
it in the frontend. I guess the same could be done with use-server in
a single backend, but I feel like this is cleaner:



frontend haproxy
  option forwardfor
  bind server.lab.local:9191
  use_backend backup_servers if { nbsrv(backend_servers) lt 2 }
  default_backend backend_servers

backend backend_servers
  server server1 192.168.239.151:9090 check
  server server2 192.168.239.152:9090 check

backend backup_servers
  server serverBKP 192.168.17.2:9090 backup



Lukas

On Sat, 19 Feb 2022 at 14:17, Carlos Renato  wrote:
>
> Can anyone help me?
>
> How to create an ACL to use the backup server if a server goes DOWN. So, if 
> the two backend servers are UP, I use the registered servers. If one (only 
> one) becomes unavailable, traffic is directed to the backup server.
>
> Below my settings.
>
> frontend haproxy
>   option forwardfor
>   bind server.lab.local:9191
>   default_backend backend_servers
>
> backend backend_servers
>   server server1 192.168.239.151:9090 check
>   server server2 192.168.239.152:9090 check
>   server serverBKP 192.168.17.2:9090 backup
>
> Thank you for your help
>
>
>
>
> --
>
>



ACL HAPROXY (check servers UP and DOWN) and redirect traffic

2022-02-19 Thread Carlos Renato
Can anyone help me?

How to create an ACL to use the backup server if a server goes DOWN. So, if
the two backend servers are UP, I use the registered servers. If one (only
one) becomes unavailable, traffic is directed to the backup server.

Below my settings.

frontend haproxy
  option forwardfor
  bind server.lab.local:9191
  default_backend backend_servers

backend backend_servers
  server server1 192.168.239.151:9090 check
  server server2 192.168.239.152:9090 check
  server serverBKP 192.168.17.2:9090 backup

Thank you for your help



--