Configuring HAProxy (High Availability Proxy) with Odoo

admin 2019-10-23 6908


HAProxy is an open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers or multiple endpoints. The HAProxy will use a reverse proxy, which forwards the client's request to one of the available servers based on a load balancing algorithm. 


By comparing HAProxy with popular reverse proxies like Apache or NGINX web server, it consistently performs on par or better in benchmarks against others. Many top websites such as Twitter, GitHub, Instagram, Reddit, Stack Overflow and many others have started using HAProxy in recent times. 


In order to monitor and view statistics of the health of nodes, HAProxy provides a neat web interfaced monitoring system. The default configuration provided by HAProxy is simply enough to run a small website in a smooth manner. 


How to configure with odoo?

Ubuntu 18.04 LTS operating system used for the following setup. 


Before You Begin


1. Update the system

sudo apt-get update && sudo apt-get upgrade

2. Don’t forget to connect your domain to your host


Installation


sudo apt-get install haproxy


Configuration

Open /etc/haproxy/haproxy.cfg in a text editor and append the configuration for the front end (Fig.1):


listen http-in        bind *:80        stats uri /haproxy?stats        stats auth cybro:dzVfK3A8         server server1 127.0.0.1:8069 maxconn 200



Fig.1


Here,


http-in: Any name for front end


bind: Bound to all network interfaces on port 80


stats: URL for nodes status monitoring

Eg: In above configuration “/haproxy?stats” used as monitoring url. You can access the monitoring window through “http://your_website.com/haproxy?stats


stats auth: Username and password for access the monitoring tool. Successful Authentication will result in the Statics Report (Fig.2). 


server: Back end server for front end node. You can also specify the maximum connection here. User can configure multiple servers for back end nodes with different balancing algorithms (Eg: Round Robin, Refer official documentation for more refer, http://cbonte.github.io/haproxy-dconv/1.9/configuration.html). 

Running and Monitoring


1. Restart the HAProxy service:


sudo service haproxy restart

2. Go to http://your_website.com/haproxy?stats



Fig.2


Hovering mouse pointer through underlined cells will give you detailed data about the cell (Fig.3)

Fig.3


最新回复 (0)
返回