Multi-level setup
You can aggregate stick tables from other Stick Table Aggregators. This helps manage stick tables located in different locations, or AWS availability zones, for example.
As an example, we will consider the following setup:

The top-level aggr3 Stick Table Aggregator will sum the counters from the intermediate aggr1 and aggr2 aggregate stick tables. It will then send the top-level aggregate stick table to all HAProxy Enterprise nodes.
Configure the top-level Stick Table Aggregator
We will erase the content of the default /etc/hapee-extras/hapee-stktagg.cfg top-level Stick Table Aggregator configuration file, then implement the following sandbox configuration:
global
stats socket /tmp/stktagg.socket
aggregations myl2
peer aggr3 192.168.56.113:22222 local
peer aggr1 192.168.56.111:11111 down
peer aggr2 192.168.56.112:11111 down
from .aggr to .l2
-
Enable the Stick Table Aggregator CLI in the
global
section.The
stats socket
directive enables a CLI that lets you view data that the aggregator has stored.Access the API locally
global stats socket
/tmp/stktagg.socketAccess the API remotely
global stats socket ipv4@192.168.56.113:9999
-
Create an
aggregations
section with the name of your choice, and make the top-level Stick Table Aggregator listen to incoming remote peer connections through thelocal
keyword.aggregations myl2 peer
aggr3192.168.56.113:22222 local -
Make the top-level Stick Table Aggregator listen to Stick Table Aggregators that are one level lower, denoted by the
down
keyword.aggregations myl2 peer
aggr3192.168.56.113:22222 local peeraggr1192.168.56.111:11111 down peeraggr2192.168.56.112:11111 down -
Aggregate stick tables <name>.aggr to <name>.l2
aggregations myl2 peer
aggr3192.168.56.113:22222 local peeraggr1192.168.56.111:11111 down peeraggr2192.168.56.112:11111 down from .aggr to .l2The top-level Stick Table Aggregator will aggregate <name>.aggr stick tables from the intermediate Stick Table Aggregators to the <name>.l2 stick table.
Configure the intermediate Stick Table Aggregators
We will edit the /etc/hapee-extras/hapee-stktagg.cfg Stick Table Aggregator configuration file we created in the Single-level setup section. We will implement the following sandbox configuration:
global
stats socket /tmp/stktagg.socket
aggregations myaggr
peer aggr1 192.168.56.111:11111 local
peer hapee1 192.168.56.101:44444
peer hapee2 192.168.56.102:44444
from .uncombined to .aggr
peer aggr3 192.168.56.113:11111 up
forward .l2
We will populate the file from top to bottom.
-
Add a new
peer
directive for the top-level Stick Table Aggregator.The upper-level Stick Table Aggregator is denoted by the
up
keyword.Each Stick Table Aggregator is only aware of the HAProxy Enterprise nodes it manages and of the top-level Stick Table Aggregator.
global stats socket
/tmp/stktagg.socketaggregations myaggr peeraggr1192.168.56.111:11111 local peerhapee1192.168.56.101:44444 peerhapee2192.168.56.102:44444 from .uncombined to .aggr peeraggr3192.168.56.113:11111 up -
Make the intermediate Stick Table Aggregator forward the aggregate stick table from the top-level aggregator to HAProxy enterprise nodes through the
forward
directive.Intermediate Stick Table Aggregator aggr1
global stats socket
/tmp/stktagg.socketaggregations myaggr peeraggr1192.168.56.111:11111 local peerhapee1192.168.56.101:44444 peerhapee2192.168.56.102:44444 from .uncombined to .aggr peeraggr3192.168.56.113:11111 up forward .l2Intermediate Stick Table Aggregator aggr2
global stats socket
/tmp/stktagg.socketaggregations myaggr peeraggr2192.168.56.112:11111 local peerhapee3192.168.56.103:44444 peerhapee4192.168.56.104:44444 from .uncombined to .aggr peeraggr3192.168.56.113:11111 up forward .l2
The intermediate Stick Table Aggregators' configuration files are mostly identical, but:
The
peer
directives in theaggregations
section are specific to each intermediate Stick Table Aggregator.The
peer
directives containing theup
keyword are the same.
Configure the HAProxy Enterprise nodes
We will edit the /etc/hapee-2.0/hapee-lb.cfg HAProxy Enterprise configuration files we created in the Single-level setup section. We will implement the following sandbox configuration:
- HAProxy Enterprise node hapee1
-
global stats socket
/var/run/hapee-2.0/hapee-lb.sockdefaults mode http frontend mytable.uncombined bind *:80 stick-table type ip size 100 expire 1h store http_req_rate(1h) peers mypeers http-request track-sc0 src http-request deny deny_status 200 backend mytable.aggr stick-table type ip size 100 expire 1h store http_req_rate(1h) peers mypeers backend mytable.l2 stick-table type ip size 100 expire 1h store http_req_rate(1h) peers mypeers peers mypeers bind 0.0.0.0:44444 server hapee1 server aggr1 192.168.56.111:11111
On the HAProxy Enterprise nodes, the configuration files are the same, except for the server
directive in the peers
section. The local server name must match the name specified by the -L
command line argument or the localpeer
name specified in the global
section (preferred methods) or the system hostname
command (default method).
HAProxy Enterprise node hapee1 |
|
---|---|
HAProxy Enterprise node hapee2 |
|
HAProxy Enterprise node hapee3 |
|
HAProxy Enterprise node hapee4 |
|
-
Define the mytable.l2 stick table, either in a
backend
section or in thepeers
section.- Stick table definitions in a
backend
section -
backend mytable.l2 stick-table type ip size 100 expire 1h store http_req_rate(1h) peers mypeers
- Stick table definitions in
peers
section -
peers mypeers bind 0.0.0.0:44444 server hapee1 server aggr1 192.168.56.111:11111 table mytable.uncombined type ip size 100 expire 1h store http_req_rate(1h) table mytable.aggr type ip size 100 expire 1h store http_req_rate(1h) table mytable.l2 type ip size 100 expire 1h store http_req_rate(1h)
- Stick table definitions in a
Next up
Highly-available setup