Hi geeks,

For the last two days, i am trying to configure A Loadbalanced Apache Cluster.

I have a virtual box, in which i installed 3 ubuntu 10.04 server machine

I did as following


System          Name            IP

Virtual IP      evergreen       10.129.50.185
Load node 1:    load1           10.129.50.182
Apache node1:   Apache01        10.129.50.183
Apache node2:   Apache02        10.129.50.184


1.  Enable IPVS on load balancer.

echo ip_vs_dh >> /etc/modules
echo ip_vs_ftp >> /etc/modules
echo ip_vs >> /etc/modules
echo ip_vs_lblc >> /etc/modules
echo ip_vs_lblcr >> /etc/modules
echo ip_vs_lc >> /etc/modules
echo ip_vs_nq >> /etc/modules
echo ip_vs_rr >> /etc/modules
echo ip_vs_sed >> /etc/modules
echo ip_vs_sh >> /etc/modules
echo ip_vs_wlc >> /etc/modules
echo ip_vs_wrr >> /etc/modules

modprobe ip_vs_dh
modprobe ip_vs_ftp
modprobe ip_vs
modprobe ip_vs_lblc
modprobe ip_vs_lblcr
modprobe ip_vs_lc
modprobe ip_vs_nq
modprobe ip_vs_rr
modprobe ip_vs_sed
modprobe ip_vs_sh
modprobe ip_vs_wlc
modprobe ip_vs_wrr

2. Install ipvsadm and ldirectord ,heartbeat. Get perl-doc also in
order to read the ldirectord help pages.

apt-get install ipvsadm

apt-get install ldirectord

apt-get install perl-doc

apt-get install heartbeat

3. Enable packet forwarding on the load balancer in /etc/sysctl.conf.
Then load the new setting.

# Enables packet forwarding
net.ipv4.ip_forward = 1

sysctl -p

4. Configure ipvsadm. Running dpkg-reconfigure will create the two
files ipvsadm.rules and ipvsadm.

dpkg-reconfigure ipvsadm
Load on boot:  No
Daemon method: none

/etc/ipvsadm.rules
# emtpy rules file for ipvsadm

/etc/default/ipvsadm
AUTO="false"
DAEMON="none"



5. Configure ldirectord.

/etc/ha.d/ldirectord.cf
checktimeout=10
checkinterval=2
autoreload=no
logfile="/var/log/ldirectord.log"
quiescent=yes
virtual=10.129.50.185:80
    real=10.129.50.183:80 gate
    real=10.129.50.184:80 gate
    service=http
    request="ldirector.html"
    receive="Test Page"
    scheduler=wlc
    protocol=tcp
    checktype=negotiate
virtual=10.129.50.185:443
    real=10.129.50.183:443 gate
    real=10.129.50.184:443 gate
    service=http
    request="ldirector.html"
    receive="Test Page"
    scheduler=wlc
    protocol=tcp
    checktype=negotiate



Point to this file in /etc/default/ldirectord
CONFIG_FILE=/etc/ha.d/ldirectord.cf

Status of ldirector:

ldirectord ldirectord.cf status

The actual output should like below

\1 better written as $1 at /usr/sbin/ldirectord line 1252.
\1 better written as $1 at /usr/sbin/ldirectord line 1252.
ldirectord for /etc/ha.d/ldirectord.cf is running with pid: 2629

but for me

\1 better written as $1 at /usr/sbin/ldirectord line 1252.
\1 better written as $1 at /usr/sbin/ldirectord line 1252.
ldirectord stopped for /etc/ha.d/ldirectord.cf

7. Start ldirectord.

/etc/init.d/ldirectord start

ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  10.129.50.185:80 wlc
  -> 10.129.50.183:80             Route   1      0          0
  -> 10.129.50.184:80             Route   1      0          0
TCP  10.129.50.185:443 wlc
  -> 10.129.50.183:443            Route   0      0          0
  -> 10.129.50.184:443            Route   0      0          0


The load balancer should list the virtual IP:

ip addr sh eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 78:2b:cb:11:93:9c brd ff:ff:ff:ff:ff:ff
    inet 10.129.50.182/16 brd 10.129.127.255 scope global eth0

8. Configure the apache nodes to accept requests on the virtual IP
10.129.50.185.

/etc/sysctl.conf

net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.eth0.arp_announce = 2

Load the new settings:
sysctl -p


9. Configure /etc/ha.d/haresources (to start ldirectord from heartbeat).

load1   \
        ldirectord::ldirectord.cf \
        IPaddr2::10.129.50.185/16/eth0 \

10. Configure network interface for the virtual IP on the apache servers.

/etc/network/interfaces
# Load balancing virtual interface
auto lo:0
iface lo:0 inet static
  address 10.129.50.185
  netmask 255.255.0.0
  pre-up sysctl -p > /dev/null

enable the interface:
ifup lo:0

Run ifconfig to verify interface is up:
lo:0      Link encap:Local Loopback
          inet addr:10.129.50.185  Mask:255.255.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1

11. Create /var/www/ldirector.html on the apache servers.

Test Page

12. Test.

Browse to 10.129.50.185 (virtual IP)

Everying done without error. But Virtual IP not displaying anything
and i can ping load balancer 10.129.50.182 but i can not ping
10.129.50.183 and 10.129.50.184 apache servers.





-- 




Cheers,

Dhastha
Project staff
Indian Institute of Technology, Bombay

My experience on Linux:   http://dhastha.wordpress.com
Member of KanchiLUG :   http://www.kanchilug.wordpress.com
OAOD                        :   http://dowithlinux.wordpress.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to