MRKAVANA (mrkavana@gmail.com) - www.facebook.com/kavanathai

Jul 21, 2011

Ultra Monkey Cluster for Web Server on Redhat

Ultra Monkey is a packaged set of binaries for LVS, including Linux-HA for director failover and ldirectord for realserver failover. It's written by Horms, one of the LVS developers. Ultra Monkey was used on many of the server setups sold by VA Linux and presumably made lots of money for them. Ultra Monkey has been around since 2000 and is mature and stable. Questions about Ultra Monkey are answered on the LVS mailing list. Ultra Monkey is mentioned in many places in the LVS-HOWTO.
Ben Hollingsworth ben (dot) hollingsworth (at) bryanlgh (dot) org 29 Jun 2007
There's step by step instructions on How to install Ultra Monkey LVS in a 2-Node HA/LB Setup on CentOS/RHEL4 (http://www.jedi.com/obiwan/technology/ultramonkey-rhel4.html).
Dan Thagard daniel (at) gehringgroup (dot) com 3 Jul 2007
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'.
  1. 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'
  2. Click 'Next' to begin copying over the files.
  3. Remove DVD and click 'Reboot' to reboot the machine after installation.
  4. Set firewall to 'Disabled' and click 'Forward'.
    • Click 'Yes' on pop-up.
  5. Set SELinux to 'Disabled' and click 'Forward'.
  6. Select the 'Network Time Protocol' tab, check 'Enable Network Time Protocol', and click 'Forward'.
  7. Enter tester in the username field, 'Test User' in the Full name field, type in the password twice, and click 'Forward'.
  8. Click 'Forward' to skip the audio test.
  9. Click 'Finish' to complete the installation routine.
  10. Login to the local system using the root username and password.
  11. 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'.
  1. Leave the server, goto your PC and SSH into the server (e.g. PuTTY)
  2. Login as user 'tester'
  3. Su to root
su -
  1. 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
  1. Install the dries GPG key
rpm --import http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt
  1. 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
  1. Correct release version
mv /etc/redhat-release /etc/redhat-release.orig && \
echo "Red Hat Enterprise Linux Server release 5 (Tikanga)" > /etc/redhat-release
  1. 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)
  2. 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
  1. Install Ultramonkey
yum install -y heartbeat*
  1. 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
  1. Set the permission on authkeys
chmod 600 /etc/ha.d/authkeys
  1. Start the httpd server
httpd -k start
  1. 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!
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
  1. 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
  1. 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
  1. Restart the network
service network restart
  1. 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
  1. Reparse the sysctl.conf file
/sbin/sysctl -p
  1. Make sure all services set to start at system boot.
chkconfig httpd on && chkconfig --level 2345 heartbeat on && chkconfig --del ldirectord
  1. Start the heartbeat service
/etc/init.d/ldirectord stop && /etc/init.d/heartbeat start

No comments:

Post a Comment