We're here to assist with any of your needs, don't hestitate to reach out.
HAProxy is a free, open-source load balancer and proxy server software that provides high availability, load balancing, and proxying for TCP and HTTP applications. It distributes incoming requests to a set of backend servers based on a configured load balancing algorithm, enabling optimal utilization of server resources.
To install HAProxy on CentOS 8, follow these steps:
sudo dnf update -y
sudo dnf install haproxy -y
Edit the HAProxy configuration file /etc/haproxy/haproxy.cfg
to define your backend servers and load balancing algorithm:
sudo vi /etc/haproxy/haproxy.cfg
Here's an example configuration:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend myfrontend
bind 192.168.1.10:80
mode http
default_backend mybackend
backend mybackend
mode http
balance roundrobin
server server1 192.168.1.11:80 check
server server2 192.168.1.12:80 check
Save the file and exit.
sudo systemctl start haproxy
sudo systemctl enable haproxy
HAProxy should now be installed and running on your CentOS 8 system. You can access the HAProxy statistics page by visiting http://your-server-ip:8080/stats
in a web browser, replacing your-server-ip
with the IP address of your server.
What our customers say about us
Create your free account today.