HAProxy Configuration
10.1 Installing HAProxy
After preparing the dedicated Ubuntu Server virtual machine, HAProxy was installed using the Ubuntu package manager.
sudo apt update
sudo apt install haproxy -yThe installation was verified by checking the installed version.
haproxy -v10.2 Configuring the Load Balancer
The main HAProxy configuration file is located at:
/etc/haproxy/haproxy.cfgThe configuration was modified to define:
Frontend listener
Backend application servers
Load balancing algorithm
Health checks
The frontend listens on port 80 and forwards requests to the ERPNext backend servers.
The backend pool consists of:
Server | IP Address | Port |
|---|---|---|
App1 | 192.168.31.40 | 8844 |
App2 | 192.168.31.41 | 8844 |
App3 | 192.168.31.42 | 8844 |
Round Robin scheduling was selected to distribute incoming requests equally across all healthy application servers.
10.3 Validating the Configuration
Before starting HAProxy, the configuration was validated.
sudo haproxy -c -f /etc/haproxy/haproxy.cfgIf no syntax errors were reported, the HAProxy service was started.
sudo systemctl restart haproxyThe running status was verified using:
sudo systemctl status haproxy