Skip to Main Content
Linux System Administration
book

Linux System Administration

by Tom Adelstein, Bill Lubanovic
March 2007
Intermediate to advanced content levelIntermediate to advanced
304 pages
11h 12m
English
O'Reilly Media, Inc.
Content preview from Linux System Administration
158
|
Chapter 7: Load-Balanced Clusters
3. Add these lines to /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
4. Get the changes into the kernel:
# sysctl -p
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
5. Assuming that your realserver is a Debian system, edit the /etc/network/interfaces
file, associating the VIP (70.253.15.42) with the loopback alias
lo:0:
auto lo:0
iface lo:0 inet static
address 70.253.15.42
netmask 255.255.255.255
pre-up sysctl -p > /dev/null
6. Enable the loopback alias:
# ifup lo:0
7. Create the file /var/www/ldirector.html with the contents:
I'm alive!
8. On web1:
# echo "I'm web1" > /var/www/which.html
9. On web2:
# echo "I'm web2" > /var/www/which.html
10. Start Apache, or restart it if it’s already running:
# /etc/init.d/apache2 restart
The Apache access logs should not yet show any activity, because lb is not talking to
them yet.
Configuring the Load Balancer
On lb, create the load balancer configuration file, /etc/ha.d/ldirectord.cf:
checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=no
virtual=70.253.158.42:80
real=70.253.158.41:80 gate
real=70.253.158.45:80 gate
service=http
request="director.html"
receive="I'm alive!"
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux System Administration

Mastering Linux System Administration

Christine Bresnahan, Richard Blum
Mastering Linux Administration

Mastering Linux Administration

Alexandru Calcatinge, Julian Balog

Publisher Resources

ISBN: 9780596009526Supplemental ContentCatalog PageErrata