Hi.

Anyone which can help to protect the backen with backend states?

Regards
Alex

On 05.12.21 11:42, Aleksandar Lazic wrote:

Hi.

I try to protect an backend server against a overload within a master/master 
setup.
The test setup looks like this

lb1: 8081 \
            -hap-dest: 8080
lb2: 8082 /

When I now call lb1 with curl the "tracker/quota1" gpc is increased and the 
second request is denied.
The problem is that the peer on lb2 does not get the counter data to protect 
the backend on lb2 too.

Please can anybody help me to fix my mistake and find a proper solution.


```
curl -v http://127.0.0.1:8081/; curl -v http://127.0.0.1:8081
* Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0)
 > GET / HTTP/1.1
 > Host: 127.0.0.1:8081
 > User-Agent: curl/7.68.0
 > Accept: */*
 >
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< dest_dst_conn: 1
< content-length: 0
<
* Connection #0 to host 127.0.0.1 left intact

####
* Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0)
 > GET / HTTP/1.1
 > Host: 127.0.0.1:8081

< HTTP/1.1 403 Forbidden
< content-length: 93
< cache-control: no-cache
< content-type: text/html

```

``` lb1
echo "show peers;show table tracker/quota1;show table tracker/quota2"|socat - 
tcp4-connect:127.0.0.1:9990

0x55bb71554dc0: [05/Dec/2021:10:27:17] id=tracker disabled=0 flags=0x33 
resync_timeout=<PAST> task_calls=5
   0x55bb71558350: id=tracker(remote,inactive) addr=127.0.0.1:20001 
last_status=NAME last_hdshk=5m36s
         reconnect=<PAST> heartbeat=<NEVER> confirm=0 tx_hbt=0 rx_hbt=0 
no_hbt=0 new_conn=1 proto_err=0 coll=0
         flags=0x0
         shared tables:
           0x55bb7156f1e0 local_id=2 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x55bb71556a50 id=tracker/quota1 update=3 localupdate=3 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
           0x55bb7156f090 local_id=1 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x55bb71556c60 id=tracker/quota2 update=2 localupdate=2 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
   0x55bb71557300: id=h1(local,inactive) addr=127.0.0.1:20000 last_status=NONE 
last_hdshk=<NEVER>
         reconnect=<NEVER> heartbeat=<NEVER> confirm=0 tx_hbt=0 rx_hbt=0 
no_hbt=0 new_conn=0 proto_err=0 coll=0
         flags=0x0
         shared tables:
           0x55bb7156f230 local_id=2 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x55bb71556a50 id=tracker/quota1 update=3 localupdate=3 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
           0x55bb7156f0e0 local_id=1 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x55bb71556c60 id=tracker/quota2 update=2 localupdate=2 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")

# table: tracker/quota1, type: string, size:100, used:1
0x55bb71772888: key=0 use=0 exp=53297 server_id=0 gpc0=1

# table: tracker/quota2, type: string, size:100, used:1
0x55bb71772958: key=0 use=0 exp=53297 server_id=0 gpc1=0

```

``` lb2
echo "show peers;show table tracker/quota1;show table tracker/quota2"|socat - 
tcp4-connect:127.0.0.1:9991

0x5618ae836dc0: [05/Dec/2021:10:27:12] id=tracker disabled=0 flags=0x33 
resync_timeout=<PAST> task_calls=5
   0x5618ae83a350: id=tracker(remote,inactive) addr=127.0.0.1:20000 
last_status=NAME last_hdshk=5m31s
         reconnect=<PAST> heartbeat=<NEVER> confirm=0 tx_hbt=0 rx_hbt=0 
no_hbt=0 new_conn=2 proto_err=0 coll=0
         flags=0x0
         shared tables:
           0x5618ae8511e0 local_id=2 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x5618ae838a50 id=tracker/quota1 update=0 localupdate=0 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
           0x5618ae851090 local_id=1 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x5618ae838c60 id=tracker/quota2 update=0 localupdate=0 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
   0x5618ae839300: id=h2(local,inactive) addr=127.0.0.1:20001 last_status=NONE 
last_hdshk=<NEVER>
         reconnect=<NEVER> heartbeat=<NEVER> confirm=0 tx_hbt=0 rx_hbt=0 
no_hbt=0 new_conn=0 proto_err=0 coll=0
         flags=0x0
         shared tables:
           0x5618ae851230 local_id=2 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x5618ae838a50 id=tracker/quota1 update=0 localupdate=0 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")
           0x5618ae8510e0 local_id=1 remote_id=0 flags=0x0 remote_data=0x0
               last_acked=0 last_pushed=0 last_get=0 teaching_origin=0 update=0
               table:0x5618ae838c60 id=tracker/quota2 update=0 localupdate=0 
commitupdate=0 refcnt=1
         Dictionary cache not dumped (use "show peers dict")

# table: tracker/quota1, type: string, size:100, used:0

# table: tracker/quota2, type: string, size:100, used:0


```

I run haproxy with this commands.

```
# hap-dest
podman run --rm --name haproxy-dest -v /datadisk/haproxy-peer-test:/mnt 
--network host --publish 8080:8080 haproxy:2.4 -- haproxy -f 
/mnt/haproxy-dest/haproxy-dest.cfg

# lb1
podman run -d --rm --name haproxy-lb1 -v /datadisk/haproxy-peer-test:/mnt 
--network host --publish 8081:8081 --publish 9800:9800 --publish 20000:20000 
haproxy:2.4  haproxy -f /mnt/haproxy-lb1/haproxy-lb1.cfg
# lb2
podman run -d --rm --name haproxy-lb2 -v /datadisk/haproxy-peer-test:/mnt 
--network host --publish 8082:8082 --publish 9801:9801 --publish 20001:20001 
haproxy:2.4  haproxy -f /mnt/haproxy-lb2/haproxy-lb2.cfg

podman exec haproxy-dest haproxy -vv
HAProxy version 2.4.9-f8dcd9f 2021/11/24 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-2.4.9.html
Running on: Linux 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 
UTC 2021 x86_64
...
```

Attached also the configs.

Thanks for any help.

Best regards
Alex


Reply via email to