Sunday, October 12, 2014

web server load balancing and failover with pound

pound is reverse proxy and web load balancer, that we can configure load balance the apache2 web server.

1- General information

pound server: 10.0.3.1
web server 1: 10.0.3.201
web server 2: 10.0.3.202

2- install and configure pound

root@loadbalancer# apt-get install pound

- edit the /etc/pound/pound.cfg to the following content

User        "www-data"
Group        "www-data"
LogLevel    1
Alive        5
Control "/var/run/pound/poundctl.socket"
ListenHTTP
    Address 0.0.0.0
    Port    80
    Service
        BackEnd
            Address    10.0.3.201
            Port    80
        End
        BackEnd
            Address    10.0.3.202
            Port    80
        End
    End
End




3- start the pound and testing

root@loadbalancer# pound

-- disable all the backend web server and re-enable them back and check log
root@loadbalancer# tail -f /var/log/syslogOct 12 13:27:33  pound: received signal 15 - exiting...
Oct 12 13:27:30  pound: message repeated 34 times: [ (7f66a13d7700) connect_nb: error after getsockopt: No route to host]
Oct 12 13:27:33  pound: received signal 15 - exiting...
Oct 12 13:27:34  pound: Create "/var/run/pound.pid": No such device or address
Oct 12 13:30:18  pound: 127.0.0.1 GET / HTTP/1.1 - HTTP/1.1 200 OK
Oct 12 13:30:21  pound: (7f3df9752700) connect_nb: error after getsockopt: No route to host
Oct 12 13:30:21  pound: (7f3df9752700) backend 10.0.3.201:80 connect: No route to host
Oct 12 13:30:21  pound: (7f3df9752700) BackEnd 10.0.3.201:80 dead (killed)

Oct 12 13:30:21  pound: 127.0.0.1 GET /favicon.ico HTTP/1.1 - HTTP/1.1 404 Not Found
Oct 12 13:30:27  pound: (7f3df9815700) connect_nb: error after getsockopt: No route to host

Oct 12 13:32:38  pound: message repeated 6 times: [ (7f3df9815700) connect_nb: error after getsockopt: No route to host]
Oct 12 13:32:44  pound: (7f3df968f700) connect_nb: poll timed out
Oct 12 13:32:44  pound: (7f3df968f700) backend 10.0.3.202:80 connect: Connection timed out
Oct 12 13:32:44  pound: (7f3df968f700) BackEnd 10.0.3.202:80 dead (killed)

Oct 12 13:32:44  pound: (7f3df968f700) e503 no back-end "GET / HTTP/1.1" from 10.0.3.1
Oct 12 13:32:46  pound: (7f3df9815700) connect_nb: error after getsockopt: No route to host
Oct 12 13:33:16  pound: message repeated 10 times: [ (7f3df9815700) connect_nb: error after getsockopt: No route to host]
Oct 12 13:33:16  pound: BackEnd 10.0.3.201:80 resurrect
Oct 12 13:33:18  pound: 10.0.3.1 GET / HTTP/1.1 - HTTP/1.1 200 OK

Oct 12 13:33:19  pound: (7f3df9815700) connect_nb: error after getsockopt: No route to host


4- screen shot:
- disable one of the web server, our web still work

- disable all web server
 

No comments:

Post a Comment