LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: configuring LVS-DR on FC3

To: ankush grover <ankushgrover1711@xxxxxxxxx>, <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: configuring LVS-DR on FC3
From: "Matthew R. Kivela" <mkivela@xxxxxxxxxxxx>
Date: Wed, 21 Sep 2005 14:30:09 -0400
Ok, the following is a snip of code from the script I use to configure new machines here.

It is driven by variables defined at the start of the script.

(Earlier parts of the script do update FC3 with the latest up2date stuff...not sure if we introduce any dependencies there.)

I wrote this earlier this year (February), still use it as I add or rebuild servers playing around in the development cluster. Which translated means while I know it all works, I don't necessarily remember the logic off the top of my head! Also apologize, script is kind of quick & dirty.

Matt.

--begin script snip--

# Am I a real server?

if [ $real_server = YES ]
then
echo "Configuring as a real server."

  #----------------------------------------------------------
  # Configure connection to shared storage

# Note: On the $Solaris_Cluster cluster, in Veritas add the linux server name to the list of allowed hosts! # You'll also need to pull the new hosts file down to $Solaris_Cluster1 & $Solaris_Cluster2!

    cd /
    mkdir /$shared_storage
echo "$Solaris_Cluster:/SHAREDSTORAGE/Linux_Clusters/$shared_storage /$shared_storage nfs defaults 0 0" >> /etc/fstab mount -t nfs $Solaris_Cluster:/SHAREDSTORAGE/Linux_Clusters/$shared_storage /$shared_storage

  #----------------------------------------------------------
  # Configure http daemon

  # Change the default page to indicate the server:
sed -i 's/<\/strong><\/h1>/<\/strong> '"$Cap_Server_Name"' <\/h1>/g' /var/www/error/noindex.html

  # Configure the http daemon to listen on only specific IP addresses:
sed -i 's/Listen 80/Listen '"$ip"':80\nListen '"$cluster_ip"':80/g' httpd.conf

  # Configure http to start automatically:
    ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S99httpd


  #----------------------------------------------------------
  # Configure ipvs stuff

  # Determine which port is the VIP ip:
    interface=$(echo $cluster_ip | sed 's/^.*\.//g')

  # Make a ipvs file for the Real Servers:
    echo "echo 0 >/proc/sys/net/ipv4/ip_forward" > /etc/rc.d/init.d/S98ipvs
echo "echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore" >> /etc/rc.d/init.d/S98ipvs echo "echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignore" >> /etc/rc.d/init.d/S98ipvs echo "ifconfig lo:$interface $cluster_ip broadcast $cluster_ip netmask 0xffffffff up" >> /etc/rc.d/init.d/S98ipvs echo "route add -host $cluster_ip dev lo:$interface" >> /etc/rc.d/init.d/S98ipvs

  # Link in the ipvs file:
    chmod 755 etc/rc.d/init.d/S98ipvs

    if [ $virtual_server != YES ]
    then
      ln -s /etc/rc.d/rc3.d/S98ipvs etc/rc.d/init.d/S98ipvs
    else
echo "Virtual Server, no need for S98 in startup; Keepalived is used for similiar role instead" # We do still make it so a machine can be easily demoted from Virtual to pure Real.
    fi


  #----------------------------------------------------------
  # Get common set of keys for seamless ssh via the LVS system:

cp -f /$netsupport_server/support/OperatingSystems/Fedora/Keys/ssh* /etc/ssh/.
    chmod 600 ssh_host_key
    chmod 600 ssh_host_rsa_key
    chmod 600 ssh_host_dsa_key
    chmod 644 ssh_host_key.pub
    chmod 644 ssh_host_rsa_key.pub
    chmod 644 ssh_host_dsa_key.pub
    /etc/rc.d/rc3.d/S55sshd restart

else
echo "Not a real server."
fi

#----------------------------------------------------------
# Am I a Virtual Server?

if [ $virtual_server = YES ]
   then

   # Install ipvsadm:
rpm -ivh /$netsupport_server/support/OperatingSystems/Fedora/LVS_stuff/ipvsadm-1.24-5.i386.rpm

   # Install keepalived:
rpm -ivh /$netsupport_server/support/OperatingSystems/Fedora/LVS_stuff/Keepalived/keepalived-1.1.9-1.i386.rpm
       ln -s /etc/rc.d/init.d/keepalived /etc/rc.d/rc3.d/S99keepalived

else
echo "Not a virtual server."
fi


<Prev in Thread] Current Thread [Next in Thread>