HOW TO INSTALL AND CONFIGURE HAPROXY ON RHEL/CENTOS

             HOW TO INSTALL AND CONFIGURE HAPROXY ON RHEL/CENTOS

By Rohit!!!

HAproxy is very fast and reliable when it's comes when to mange application running on High availability. Nowadays most of the websites need 99.999% uptime for their site, which is not possible with single server setup. Then we need some high availability environment that can easily manage with single server failure.





step 1. HAproxy package available under default yum repository of redhat,centos systems,

you need to install package from below command

# yum install haproxy 

Step 2. Open the configuration file

# vim /etc/haproxy/haproxy.cfg


global

    log 127.0.0.1 local0 notice

    daemon

    maxconn 2000

    user haproxy

    group haproxy

#defaults

#   timeout connect 50000

#    timeout client 50000

#    timeout server 50000


frontend httpserver

    bind *:80

    default_backend httpnodes


backend httpnodes

    balance source

    server server1 10.5.80.43:80 check

    server server2 10.6.80.43:80 check

# for DB 

frontend mysqlserver

    bind *:3306

    mode tcp

    default_backend mysqlnodes


backend mysqlnodes

    mode tcp

    balance roundrobin

    server server3 10.5.80.43:3306 check

    server server4 10.5.80.44:3306 check


change the ip according to your configuration i have given example of  http as well as tcp port based scenario. 

now start the service as well enable to it automatically start when system goes restart.

# systemctl start haproxy

#systemctl enable haproxy  

I hope this will help you to understand 

Thanks !!!!

Comments

Popular posts from this blog

How To Enable SSH Login for root user in RHEL9/CENTOS9

How to Add Users/Group/OU in OpenLdap

HOW TO INSTALL AND CONFIGURE KEEPALIVE BETWEEN TWO SERVERS ON CENTOS/RHEL

Installing K8s cluster in your local environment

USEFULL COMMANDS TO MANAGE ZIMBRA USERS AND SERVICES

File Permissions in Linux