To set up HAProxy, modify the haproxy.cfg file. You can find the file under the following path:
.../etc/haproxy/haproxy.cfg
Primary setup (required)
Add two sections necessary for HAProxy operation: frontend and backend.
The frontend section
Add two settings to the frontend section: bind and default_backend.
-
In the bind setting, specify the address and the port that will receive requests distributed by HAProxy.
-
In the default_backend option, specify the name that will match the name of the backend section.
As a result, the setup will look as follows:
frontend front
maxconn 10000
#Using these ports for binding
bind *:80
bind *:443
#Convert cookies to be secure
rspirep ^(set-cookie:.*) \1;\ Secure
default_backend bpmonline
The backend section
Add 2 required settings to the backend section:
-
In the balance parameter, specify the type of balancing, e.g., roundrobin. More information about different types of balancing is available in HAProxy documentation.
-
Use the server parameter to specify all servers (or “nodes”) for distributing the load.
Add a separate “server” parameter for each server (i.e. the deployed bpm’online application instance) and specify the server / port addresses and weight. Server weight allows the balancer to distribute the load based on the physical capabilities of the servers. The more weight is specified for the server, the more requests it receives. For example, if you need to distribute the load between 2 bpm’online application servers, add 2 “server” parameters to backend:
server node_1 [server address]:[port] weight
server node_2 [server address]:[port] weight
As a result, the setup will look as follows:
backend bpmonline
#set balance type
balance roundrobin
server node_1 nodeserver1:80 check inter 10000 weight 2
server node_2 nodeserver2:80/sitename check inter 10000 weight 1
The new settings will be applied as soon as you restart HAProxy. To restart HAProxy, use the following command:
service haproxy restart
web Statistics setup (optional)
To enable web-statistics, add a new “listen” section with the following parameters: bind, mode http, stats enable, stats uri. The syntax is as follows:
listen stats # Define a listen section called "stats»
bind :9000 # Listen on localhost:9000
mode http
stats enable # Enable stats page
stats uri /haproxy_stats # Stats URI
As a result, the web-statistics of bpm’online load balancing will be available for viewing in the browser.
To view the statistics, follow the path: [balancer address]:9000/haproxy_stats.
See also
• Server-side system requirements