Install Pen to configure Load Balance server. Pen is a light weight simple load balancer. This example shows to configure on the environment like follows.
192.168.2.56 ------ Pen Server
192.168.2.55 ------ Web Server1
192.168.2.100 ----- Web Server2
192.168.2.95 ----- Web Server3
Set index.html in Document Root -- For testing from which server its resolving
set hostname if needed
set ip in /etc/hosts --------------- For basic dns resolution
Here use IP Based virtual hosting ---------- no need of any virtual hosting if it is not a website, instead if it is a cgi just make change in httpd.conf as follows
Listen 192.168.2.55:80 ------ in each host
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
#<Directory "/var/www/cgi-bin">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</Directory>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
Options +ExecCGI
AuthName "CGI Authentication"
AuthType Basic
AuthUserFile /etc/httpd/passwd
require valid-user
</Directory>
OR
In httpd.conf make // Listen 192.168.2.55:80 and etc,
# yum install httpd
# service httpd start
# chkconfig httpd on
# wget http://siag.nu/pub/pen/pen-0.18.0.tar.gz
# tar -xvzf pen-0.18.0.tar.gz
# cd pen-0.18.0/
# ./configure
# make
# make install
# service httpd stop
Bcz We have to run pen in port 80 or when starting pen it will conflict with httpd server port
# ls /usr/local/bin/
# /usr/local/bin/pen -r -b2 192.168.2.56:80 192.168.2.55:80 192.168.2.100:80 192.168.2.95:80
the -r flag denotes 'round robin'.
In Browser take http://192.168.2.56/ it will connect to any of the above three web servers. Either than load balancing pen also povide Failover as well.
To check this stop apache in any of the above web server, then pen will automatically failover to next available web server.
Point it to a web site it will work for load balancing the same.
Terima kasih telah membaca artikel tentang Pen Load Balancer: How to setup pen load balancer and Failover di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.