Showing posts with label LOADBALANCER. Show all posts
Showing posts with label LOADBALANCER. Show all posts

How to enable HAProxy stats on CentOS 7 server step by step guide



In this tutorial we learn how to enable HAProxy stats on centos server.We can  get lot of info like data transfer, node status, connection status using HAProxy stats . After installing HAProxy we should enable HAProxy stats to get information through web browser.

Enable HAProxy stats on centos server

To enable HAProxy stats first we need to go haproxy configuration file and edit this file and add the below lines after default section.




listen  stats   192.168.137.6:3000
        mode            http
  
        maxconn 10

        timeout client          300s
        timeout server        300s
        timeout connect     300s
        timeout queue        300s

        stats enable
        stats refresh 10s
        stats show-node
        stats auth haproxyadmin:haproxyadmin
        stats uri  /haproxy




After doing the above configuration we can access using the below link through the web browser.


http://192.168.137.6:3000/haproxy


username : haproxyadmin
password:   haproxyadmin


How to enable HAProxy stats on CentOS 7 server step by step guide
How to enable HAProxy stats on CentOS 7 server step by step guide


you can change the auth parameter using stats auth parameter and also you can change uri parameter as per your choice.



That’s all. We have enabled HAProxy stats if this article helpful please share it!!!!!



How to install and configure HAProxy on centos 7 step by step guide



In this article we learn what is HAProxy and how to setup and configure HAProxy on centos 7 server .

What is HAProxy

HAProxy is a free, very fast and reliable solution which provides high availability ,load balancing and proxying for the TCP and HTTP based application.

 Installtion of HAProxy on centos server

HAProxy package is available in the default centos repo. To install the HAProxy package we need to execute the below command.

[root@localhost ~]# yum install haproxy
How to install and configure HAProxy on centos 7 step by step guide
How to install and configure HAProxy on centos 7 step by step guide


Configuration of HAProxy on centos server


To configure HAProxy as per our requirement we need to go its configuration file which is located at “/etc/haproxy/haproxy.cfg”
Sample configure file as below.
global
        daemon
        maxconn 256
        log         127.0.0.1 local2

    defaults
        timeout queue           1m
        timeout connect         10s
        timeout client          1m
        timeout server          1m
        timeout http-keep-alive 10s
        timeout check           10s

    listen http 192.168.137.6:80
       mode http
       balance roundrobin
       server server1 192.168.137.5:8080
       server server2 192.168.137.4:8080

When any request hits on the ip 192.168.137.6 on port 80 it will be redirected on server1 and server2 ip addresses along with their respective ports.

And also we can change our configuration parameter as per our requirement .
Mode: you can change it either”http” or “tcp” as per requirement.

Balance: you can change also load balancing method as per requirement.

After configuring all the above stuff we can start the haproxy service and enable it at startup mode.

#systemctl start haproxy
#systemctl enable haparoxy


That’s all.We have configured haproxy if this article helpful please share it!!

Introduction of Load Balancer with example


Introduction of Load Balancer with example

In this article we learn what is load balancer, feature of load balancer and different type of algorithms used by a load balancer to distribute load traffic to the backend servers.

Load balancer has a feature to distribute load traffic to the backend servers. It is used to increase performance ,scalability and availability to access the service in the large traffic environment.

Normally load balancer is used to  load traffic to the backend servers.  Lets take an example if in an organization existing web server is overloaded by hitting huge no of traffic into the server, to fast the processing speed of the web server we need to add extra one or many web server  to access web portal from the outside world. Now we place the load balancer top of the web servers to distribute traffic to all the web servers equally.

Introduction of Load Balancer with example

                                      Introduction of Load Balancer with example



Feature of Load Balancer

Load balancer has one feature which is it checks periodically server health. If a server failed the load balancer detect the problem and bypass the server and allocate the entire load to the other live server to maintain the high availability. we can manage logical server from the load balancer.

Other feature is that persistency. It provides persistence feature to allow user to connect their connection to the same server. this feature is very helpful when we are taking about ecommerce site. When  users purchasing some online things via online  shopping cart they are using same server though this feature of load balancer.

Other feature is that cookies persistence. when user login a website load balancer sent the cookies to end user system .user can surfing website without relogin but it has time frame.when it is expired user has to login again to access the website.

Algorithms of Load Balancer

Round robin : Normally it is used in the load balancer to distribute traffic to all servers equally. First connection send to the first server and next connection send to the next server and so on.

Shortest path:  it calculates the path matric which path is short to reach the server.

Server weight:server weight assigns to all servers and traffic is distributed to the servers according against their assign value. if server1 has a value which is 1 and server2 has a value which is 3 then load balancer sends 3 times more traffic to server2.

Least connection: load balancer send the traffic to the server which has lowest no of open connection.