[lvs-users] CentOS-5 VLS doesn't virtual httpd doesnt failover when httpd dies
Dan Thagard
daniel at gehringgroup.com
Tue Jul 3 15:03:06 BST 2007
Sorry for the longwinded reply (and I hope I'm not spamming the list), but I thought this might help. I recently setup LVS using the Ultramonkey RPMs. The following is a (based on my understanding) complete howto for setting up CentOS 5 with LVS:
Generic CentOS 5 x64 Install on 2 PCs using Ultramonkey and Streamlined/HA topology with Apache
The following assumptions were made:
Real Server names are ws01.testlab.local and ws02.testlab.local (Replace these with the result from uname -n from each RS) Real Server IPs are 10.0.0.10/24 and 10.0.0.20/24, Gateway: 10.0.0.1, Virtual IP: 10.0.0.100
Username: tester
1. Power PC and insert CD during BIOS.
2. Boot to CD.
3. Hit 'Enter' for Graphical Installer.
4. You will be prompted to test the installation media. You may choose to test the media or skip the test (usually you can skip this step).
5. Click 'Next' to begin installation.
6. Select 'English' as installation language and click 'Next'.
7. Select 'U.S. English' as the keyboard configuration and click 'Next'.
8. Select 'Remove all partitions on selected drivers and create default layout' and click 'Next'.
9. Configure the network settings for each adapter.
a. Click 'Edit'.
i. Uncheck Configure using DHCP
ii. Input the IP Address and Netmask.
iii. Click 'OK'.
b. Input the Gateway and DNS and click 'Next'.
10. Select 'America/ New York' and click 'Next'.
11. Enter the root password twice and click 'Next'.
12. Select the system packages.
a. Check 'Desktop-Gnome', 'Server', 'Server-GUI', 'Clustering', 'Storage Clustering'
b. Select 'Customize Now'
c. Click 'Next'.
13. Configure the system packages.
a. Expand and click 'Details' on Desktop Environments->GNOME Desktop Environment.
i. Uncheck 'desktop-printing', 'dvd+rw tools', 'esc', 'gimp-print-utils', 'gnome-audio', 'gnome-backgrounds', 'gnome-mag', 'gnome-pilot', 'gnome-themes', 'gok', and 'nautilus-cd'
b. Expand Servers.
i. Uncheck 'DNS', 'Legacy Network Server', 'Mail Server', 'Network Servers', 'News', and 'Printing Support'
c. Expand Base System.
i. Uncheck 'Dialup Networking Support'
d. Expand and click 'Details' on Base System->Base.
i. Uncheck 'bluez-utils' and 'ccid'
e. Click 'Next'
14. Click 'Next' to begin copying over the files.
15. Remove DVD and click 'Reboot' to reboot the machine after installation.
16. Set firewall to 'Disabled' and click 'Forward'.
a. Click 'Yes' on pop-up.
17. Set SELinux to 'Disabled' and click 'Forward'.
18. Select the 'Network Time Protocol' tab, check 'Enable Network Time Protocol', and click 'Forward'.
19. Enter tester in the username field, 'Test User' in the Full name field, type in the password twice, and click 'Forward'.
20. Click 'Forward' to skip the audio test.
21. Click 'Finish' to complete the installation routine.
22. Login to the local system using the root username and password.
23. Edit the '/etc/group' file
vi /etc/group
a. Locate the user 'tester' and append 'wheel' (i to insert, [ESC] to stop editing).
b. Save the file and exit by typing ':wq'.
24. Leave the server, goto your PC and SSH into the server (e.g. PuTTY)
25. Login as user 'tester'
26. Su to root
su -
27. Install the dries yum repository by creating dries.repo in the /etc/yum.repo.d/ directory with the following contents
[/etc/yum.repo.d/dries.repo]
[dries]
name=Extra Fedora rpms dries - $releasever - $basearch baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el5/en/x86_64/dries/RPMS
28. Install the dries GPG key
rpm --import http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt
29. Update your local packages and install some additional ones
yum update -y && yum -y install lynx libawt xorg-x11-deprecated-libs nx freenx arptables_jf httpd-devel
30. Correct release version
mv /etc/redhat-release /etc/redhat-release.orig && echo "Red Hat Enterprise Linux Server release 5 (Tikanga)" > /etc/redhat-release
31. Download the Ultramonkey RPMs from http://www.ultramonkey.org (also grab perl-MAIL-POP3Client, available from http://rpm.pbone.net/index.php3/stat/4/idpl/4508518/com/perl-Mail-POP3Client-2.17-1.el5.centos.noarch.rpm.html as of the time of this writing)
32. Install the arptables-noarp-addr and perl-Mail-POP3Client RPMs (change the cd path to wherever you downloaded Ultramonkey to)
cd /usr/local/src/Ultramonkey && rpm -Uvh arptables-noarp-addr-0.99.2-1.rh.el.um.1.noarch.rpm && rpm -Uvh perl-Mail-POP3Client-2.17-1.el5.centos.noarch.rpm
33. Install Ultramonkey
yum install -y heartbeat*
34. Download and edit the Ultramonkey config files that relate your desired topology from http://www.ultramonkey.org to the /etc/ha.d/ directory and edit them to meet your desired configuration. Examples as follows:
[/etc/ha.d/authkeys]
auth 2
2 sha1 Ultramonkey!
[/etc/ha.d/ha.cf]
logfacility local0
mcast eth0 225.0.0.1 694 1 0
auto_failback off
node ws01.testlab.local
node ws02.testlab.local
ping 10.0.0.1
respawn hacluster /usr/lib64/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
[/etc/ha.d/haresources]
ws01.testlab.local \
ldirectord::ldirectord.cf \
LVSSyncDaemonSwap::master \
IPaddr2::10.0.0.100/24/eth0/10.0.0.255
[/etc/ha.d./ldirector.cf]
checktimeout=10
checkinterval=2
autoreload=yes
logfile="/var/log/ldirectord.log"
quiescent=no
# Virtual Service for HTTP
virtual=10.0.0.100:80
fallback=127.0.0.1:80
real=10.0.0.10:80 gate
real=10.0.0.20:80 gate
service=http
request="alive.html"
receive="I'm alive!"
scheduler=wrr
persistent=1800
protocol=tcp
checktype=negotiate
# Virtual Service for HTTPS
virtual=10.0.0.100:443
fallback=127.0.0.1:443
real=10.0.0.10:443 gate
real=10.0.0.20:443 gate
service=https
request="alive.html"
receive="I'm alive!"
scheduler=wrr
persistent=1800
protocol=tcp
checktype=negotiate
35. Set the permission on authkeys
chmod 600 /etc/ha.d/authkeys
36. Start the httpd server
httpd -k start
37. Create alive.html in the /var/www/html folder with the following text (set this to whatever file you have set in the monitoring script)
I'm alive!
a. Edit the /etc/hosts file to include the FQDN of all of the machines in your LVS (not strictly necessary, but it helps avoid problems)
# Do not remove the following line, or various programs # that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.0.0.10 ws01.testlab.local ws01
10.0.0.20 ws02.testlab.local ws02
::1 localhost6.localdomain6 localhost6
38. Edit the /etc/sysconfig/network-scripts/ifcfg-lo file with your virtual IP
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
DEVICE=lo:0
IPADDR=10.0.0.100
NETMASK=255.255.255.255
NETWORK=10.0.0.0
BROADCAST=10.0.0.255
ONBOOT=yes
NAME=loopback
39. Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file to match this (edit the IP address for each director/real server, change from eth0 to whatever active interface you are using):
[/etc/sysconfig/network-scripts/ifcfg-eth0 on ws01] DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=10.0.0.10 NETMASK=255.255.252.0
GATEWAY=10.0.0.1
[/etc/sysconfig/network-scripts/ifcfg-eth0 on ws02] DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=10.0.0.20 NETMASK=255.255.252.0
GATEWAY=10.0.0.1
40. Restart the network
service network restart
41. Enable packet forwarding and arp ignore in the /etc/sysctl.conf file
net.ipv4.ip_forward = 1
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.eth0.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
42. Reparse the sysctl.conf file
/sbin/sysctl -p
43. Make sure all services set to start at system boot.
chkconfig httpd on && chkconfig --level 2345 heartbeat on && chkconfig --del ldirectord
44. Start the heartbeat service
/etc/init.d/ldirectord stop && /etc/init.d/heartbeat start
------ End Install ------
Search lvs-users Archives
More information about the lvs-users
mailing list