Jump to content


OVH - Load balancing tutorial via API

  • Please log in to reply
No replies to this topic

#1 John



  • Administrators
  • 73 posts

Posted 01 November 2014 - 05:47 PM

Here's a quick how-to for the load balancing IP feature that OVH provides. At the time of writing there is only a France version of a guide. I'll try to explain how to configure load balancing step by step. 


Obviously you'll need to "identical" servers that host the same website, same database, etc. I'm not going in detail how to configure this. This guide only provides information on how to setup load balancing via the API that OVH provides. 


Go to https://api.ovh.com/console and login so you are able to GET and POST commands. 


Go to the /ip/loadBalancing section and click Execute, you will get the service name. For example:


Now go to /ip/loadBalancing/{serviceName}/backend and fill in the information:


serviceName - for example ip-

ipBackend - add the IP of the server you want to add
probe - how should OVH check if the service is available? Via ICMP, HTTP, NONE or OCO?
weight - give a weight per server
Click on Execute. This will take a while, after a minute you can try to add the second server. Keep in mind that the servers have to be located in the same datacenter!
If you change the DNS of the website you have hosted on both servers to the loadbalacing IP address, you will see the message "Apache is functioning normally". That's because your servers don't know the request is from a loadbalancer. To let the servers know we are going to install mod_rpaf, you can download it here: https://github.com/gnif/mod_rpaf
On CentOS you install it like this:
yum install httpd-devel
wget https://github.com/gnif/mod_rpaf/archive/stable.zip
unzip stable.zip
cd mod_rpaf-stable
make install

Now configure Apache, just add these lines to /etc/httpd/conf/httpd.conf:

LoadModule              rpaf_module /usr/lib/apache//mod_rpaf.so
RPAF_Enable             On
RPAF_SetHostName        On
RPAF_SetHTTPS           On
RPAF_SetPort            On
RPAF_ForbidIfNotProxy   Off

You will have to edit RPAF_ProxyIPs with the IP address of your loadbalancer, you can find it by looking at the OVH API at /ip/loadBalancing/{serviceName}/internalNatIp. 



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users