You are on page 1of 17

Nimbus: Load balancing

by various contributors (see last slide)

Request for contributors


Hi and thanks for your contribution! If you have modified something, I'm kindly asking you to - put your name in the last slide - write a quick note the next slide concerning what you have modified/added/deleted (since googledocs does not provide this feature, it only says who has modified the presentation and how many slides have been modified)

Massimo Canonico (mex@di.unipmn.it)

If you want to became an editor, just send me an email!

Revision history

14/12/11 - M. Canonico 14/12/11 - M. Canonico - uploaded on GD and first draft

ToDO list
Fix layout Make it less FutureGrid centric Mark slides "only for FutureGrid users" when it is necessary Improve exercise part

Exercise
Installation and configuration of a load balancer tool for 2 working spaces by using Nimbus as cloud platform debian-tutorial image as load balancer server debianJoomla images as backend servers (or any image with a web server) Pound as load balancer tool

Pound
The Pound program is a reverse proxy, load balancer and HTTPS
front-end for Web server(s). Pound was developed to enable distributing the load among several Web-servers and to allow for a convenient SSL wrapper for those Web servers that do not offer it natively. Pound is distributed under the GPL - no warranty, it's free to use, copy and give away

What Pound does


1. a reverse-proxy: it passes requests from client browsers to 2.
one or more back-end servers. a load balancer: it will distribute the requests from the client browsers among several back-end servers, while keeping session information. an SSL wrapper: Pound will decrypt HTTPS requests from client browsers and pass them as plain HTTP to the back-end servers. an HTTP/HTTPS sanitizer: Pound will verify requests for correctness and accept only well-formed ones. a fail over-server: should a back-end server fail, Pound will take note of the fact and stop passing requests to it until it recovers. a request redirector: requests may be distributed among servers according to the requested URL.

3. 4. 5. 6.

Pound overview

Prepare the instances


We have three machines two web servers (serverA and ServerB) a load-balancing server (serverX). Start 3 workspaces 1 from debian-tutorial image (we'll call it ServerX) 2 from debianJoomla image (we'll call them ServerA and ServerB) Take note of their IP addresses and hostnames in the following slides we'll consider serverA, IP: aaa.aaa.aaa.aaa serverB, IP: bbb.bbb.bbb.bbb serverX, IP: xxx.xxx.xxx.xxx

Installation and configuration Pound on ServerX


On the load-balancing server, we install Pound: sudo apt-get install pound Once you have done, edit the config file with the information concerning servers IPs and ports sudo vi /etc/pound/pound.cfg Increase the Pound debug info sudo vi /etc/pound/pound.cfg set LogLevel=2

/etc/pound/pound.cfg
ListenHTTP Address xxx.xxx.xxx.xxx Port 80 xHTTP 0 Service BackEnd Address aaa.aaa.aaa.aaa Port 80 End BackEnd Address bbb.bbb.bbb.bbb Port 80 End End End

Pound configuration
Enable the Pound service sudo vi /etc/default/pound set startup=1 Start Pound sudo /etc/init.d/pound start (do not use "restart") Chek pount d status (it must be "running") sudo /etc/init.d/pound start Now you can point you browser to http://xxx.xxx.xxx.xxx and check if your server web is up and running http://xxx.xxx.xxx.xxx/joomla and check if joomla is up and running

Pound: behind the scene

Let's see what the log file says tail -f /var/log/daemon.log

/var/log/daemon.log

Dec 14 09:08:14 vm-159 pound: 193.206.55.34 GET /joomla/index.php HTTP/1.1 - HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.143: 80) 0.150 sec Dec 14 09:36:13 vm-159 pound: 193.206.55.34 GET /joomla/index.php HTTP/1.1 - HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.156: 80) 0.151 sec Dec 14 09:50:13 vm-159 pound: 193.206.55.34 GET /joomla/index.php HTTP/1.1 - HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.156: 80) 0.139 sec Dec 14 10:18:16 vm-159 pound: 193.206.55.34 GET /joomla/index.php HTTP/1.1 - HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.143: 80) 0.151 sec Dec 14 10:32:13 vm-159 pound: 193.206.55.34 GET /joomla/index.php HTTP/1.1 - HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.156: 80) 0.140 sec

/var/log/daemon.log (cont)

Dec 14 08:44:13 vm-159 pound: 193.206.55.34 GET / HTTP/1.1 HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.156:80) 0.001 sec Dec 14 08:44:14 vm-159 pound: 193.206.55.34 GET / HTTP/1.1 HTTP/1.1 200 OK (149.165.148.159/- -> 149.165.148.156:80) 0.001 sec Dec 14 08:44:36 vm-159 pound: (f7b44b90) connect_nb: error after getsockopt: Connection refused Dec 14 08:45:36 vm-159 pound: (f7b44b90) connect_nb: error after getsockopt: Connection refused

/var/log/daemon.log (cont)

Dec 14 08:50:36 vm-159 pound: (f7b44b90) connect_nb: error after getsockopt: Connection refused Dec 14 08:51:36 vm-159 pound: (f7b44b90) connect_nb: error after getsockopt: Connection refused Dec 14 08:52:07 vm-159 pound: BackEnd 149.165.148.143:80 resurrect Dec 14 08:52:22 vm-159 pound: 193.206.55.34 GET / HTTP/1.1 HTTP/1.1 304 Not Modified (149.165.148.159/- -> 149.165.148.156:80) 0.001 sec Dec 14 08:52:25 vm-159 pound: 193.206.55.34 GET / HTTP/1.1 HTTP/1.1 304 Not Modified (149.165.148.159/- -> 149.165.148.143: 80) 0.000 sec

Troubleshooting

If the pound server fails on starting-up, set the ListenHTTP server with the private IP address on pound config file you can get the private IP by using the "ifconfig" command

You might also like