Skip to content

Installation of haproxy

anjalysuresh edited this page Feb 2, 2018 · 7 revisions
  1. First thing let’s upgrade the packages:
   sudo apt-get update
   sudo apt-get -y upgrade
  1. Install haproxy
   sudo apt-get install haproxy -y
  1. Enable haproxy
   sudo vi /etc/default/haproxy
   The variable ‘Enabled’ is set 0. Set it to 1 as shown below
   ENABLED=1
   Save and exit
  1. Configure haproxy
   sudo vi /etc/haproxy/haproxy.cfg

Add the following lines at the end of file

        #frontend haproxy_in
        frontend http_front
        bind *:80
        default_backend http_back

        #backend haproxy_http
        backend http_back
        balance roundrobin
        mode http
        server vm1 10.129.26.148:80 check
        server vm2 10.129.26.188:80 check
  1. Restart and test haproxy
   sudo /etc/init.d/haproxy restart

Open the browser and check the url which haproxy is installed

   http://10.129.26.119

  1. Check access log for haproxy in both vms
   sudo vi /home/collaboration/tester/logs/nginx-access.log(in 10.129.26.148)
   or
   sudo vi /home/edx/logs/nginx-access.log(10.129.26.188)

Contents

Clone this wiki locally