HAProxy is a load balancer for Redhat and Centos 7 and above.
Yum install haproxy
the config file to edit is /etc/haproxy/haproxy.config
Syntax:
frontend (friendly-label)
bind *service/port
mode tcp/http
default_backend (name_of_backend_to_use)
backend (name_of_backend)
mode (tcp/http)
balance (method used to load balance eg round robin,leastconn,source)
server (friendly_name eg server1) (IP)n.nnn.n.nn check
server (friendly_name eg server2) (IP)n.nnn.n.nn check
server (friendly_name eg server3) (IP)n.nnn.n.nn check
The below example will load balance all trafic sent to the load balancer on port 9796 between the 2 X backend Servers using round robin.
frontend 9796
bind *:9796
mode tcp
default_backend 9796
backend 9796
mode tcp
balance roundrobin
server server1 10..0.0.1:9796 check
server server2 10..0.0.2:9796 check
after editing the /etc/haproxy/haproxy.config file using your favourite editor
Restart the ha proxy service
service haproxy restart