LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

RE: Connection Synchronization question

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: Connection Synchronization question
From: "Peter Mueller" <pmueller@xxxxxxxxxxxx>
Date: Wed, 7 Jul 2004 18:00:37 -0700
> On Sun, Jun 20, 2004 at 10:53:27AM -0500, tuliol@xxxxxxxxxxxx wrote:
> > Currently I have connection synchronization working between 
> directors.  The 
> > setup is configured by manually running the commands:
> > 
> > ipvsadm --start-daemon master #Master Linux director
> > ipvsadm --start-daemon backup #Slave Linux director
> > 
> > My question is: Is there a way to automatically start those 
> 2 processes by 
> > putting a setting in the ldirectord config file or somewhere else?
> 
> Ldirectord is one option. However it only really makes sense if
> you are running it as a stand alone daemon, as you want the
> synchronisation daemons running all the time.
> 
> If you are using something like heartbeat to start and stop 
> ldirectord,
> then you don't want the synchronisation daemons handled there,
> else the synchronisation daemon won't run when the ldirectord
> resource is relinqushed on a node, and this really isn't what 
> you want.
> 
> ipvsadm has an init script, You should be able to use that
> to start and stop the daemons. 

Well here's what I am going to be doing in my next cluster going live
very soon now (sm).  If anyone sees anything silly please let me know.
Note that if you copy my config you will have to change
/etc/ha.d/update's SSH line to the proper host, and reverse it for the
backup host.  You will also probably want an ssh-public key login setup,
although I'm not certain I'm going to do this.

</etc/ha.d/resource.d/lvsstate.sh>
#!/bin/sh
# script to set the sync state properly on both LVS servers.

case "$1" in
  start)
    /sbin/ipvsadm --stop-daemon
    /sbin/ipvsadm --start-daemon master
  ;;
  stop)
    /sbin/ipvsadm --stop-daemon
    /sbin/ipvsadm --start-daemon backup
  ;;
esac

exit 0

</etc/ha.d/haresources>
IPaddr::ip.goes.here.here \
...
ldirectord::ldirectord.cf \
lvsstate.sh

</etc/ha.d/update>
#!/bin/sh
# script for updating ldirectord nicely.  created 06/05/2001 PM

# first, backup ldirectord.cf in case someone messes up later.
cp -f /etc/ha.d/conf/ldirectord.cf
/etc/ha.d/conf/backup.of.ldirectord.cf

# next, scp the ldirectord.cf file over to the other director
# the two LVS servers will have to have public-key acceptance for this
to work.
scp /etc/ha.d/conf/ldirectord.cf lvs2-priv:/etc/ha.d/conf/.

# make sure the state is set properly for the active server
ssh rwclvs2-priv /etc/ha.d/lvsstate.sh stop
/etc/ha.d/lvsstate.sh start

# reload ldirectord
killall -HUP ldirectord

# give it a few seconds to allow the config to set
sleep 10

# now display configuration
ipvsadm -L
ipvsadm -L --daemon

I hope it helps,

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