Monday 10 December 2012

Pound Load balance


Install Pound to make the server load balancer. 
This example shows to configure on the environment like follows  

(1) www.server.world       [10.0.0.50]   Pound Server
(2) www01.server.world   [10.0.0.51]   Web Server#1 ( receive requests to www.server.world )
(3) www02.server.world   [10.0.0.52]   Web Server#2 ( receive requests to www.server.world )
(4) www03.server.world   [10.0.0.53]   Web Server#3 ( receive requests to www.virtual.host )
(5) www04.server.world   [10.0.0.54]   Web Server#4 ( receive requests to anything except them above )
 
[1]  Install and Configure Pound 
 
[root@www ~]#

yum --enablerepo=epel -y install Pound

# install from EPEL

[root@www ~]#

vi /etc/pound.cfg

# line 13: add ( log level - max=5 )

LogLevel 3

# line 14: add ( Interval of heartbeat - seconds )

Alive 30

# line 21-25: make it comments
#ListenHTTPS
#Address 0.0.0.0
#Port 443
#Cert "/etc/pki/tls/certs/pound.pem"
#End

Service

# for the requests to www.server.world
HeadRequire "Host: .*www.server.world"
BackEnd
# backend server's IP address
Address 10.0.0.51
# backend server's port
Port 80
End
BackEnd

# backend server's IP address

Address 10.0.0.52
# backend server's port
Port 80
End
End

Service

# for the requests to www.virtual.host
HeadRequire "Host: .*www.virtual.host"
BackEnd
# backend server's IP address
Address 10.0.0.53
# backend server's port
Port 80
End
End

Service

# for the requests to anything except them avobe

HeadRequire "Host: .*"

BackEnd
# backend server's IP address
Address 10.0.0.54
# backend server's port
Port 80
End
End

[root@www ~]#

/etc/rc.d/init.d/pound start

 

Starting Pound: starting...
[ OK ]
[root@www ~]#
chkconfig pound on 
[2] Access to the Pound Server ( www.server.world ) with Web browser and make sure www01.server.world answers like follows.
 
[3] Shutdown www01.server.world by manually, then www02.server.world answers like follows.
[4] Access to the URI www.virtual.host, then www03.server.world answers like follows.
[5] Access to the IP address directly, then www04.server.world answered.
  

No comments:

Post a Comment