So I guess this means it's a bad idea to just add the lines...
ipvsadm --start-daemon master
ipvsadm --start-daemon slave
..to rc.local?
Fortunately, I am shameless about displaying my ignorance.
Disclaimer - July 5, 2006
This email and any files transmitted with it are confidential and intended
solely for LinuxVirtualServer.org users mailing list.,Horms,
Robinson@xxxxxxxxxxxxxxxxxx If you are not the named addressee you should not
disseminate, distribute, copy or alter this email. Any views or opinions
presented in this email are solely those of the author and might not represent
those of Physician Select Management (PSM) or Physician's Managed Care (PMC).
Warning: Although the message sender has taken reasonable precautions to ensure
no viruses are present in this email, neither PSM nor PMC can accept
responsibility for any loss or damage arising from the use of this email or
attachments.-----Original Message-----
From: lvs-users-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:lvs-users-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Roberto
Nibali
Sent: Wednesday, July 05, 2006 4:04 AM
To: LinuxVirtualServer.org users mailing list.
Cc: Horms; Robinson@xxxxxxxxxxxxxxxxx
Subject: Re: At Startup, I Get This: sed: -e expression
#1,char1:?unknown?command: `%'
Hello Horms,
Usual nitpicking :).
> I wrote up a patch to do this, it adds the sync_daemon option to
> ldirectord.cf. Though I am not sure if it should be added to
> ldirectord, as it may confuse people who run ldirectord out of
> heartbeat's haresources file.
> +B<sync_daemon = >[B<off>|B<on>|B<master>|B<backup>]
> +
> +Start the LVS synchronsation daemon. off will not start the daemon.
s/chrons/chronis/
> +on starts both the master and backup daemons. master will start only
> +the master daemon. backup will start only the backup daemon.
> +
> +If a daemon is configured to be started by ldirectord, it will also
> +be stopped by ldirectord when ldirectord exits. If ldirectord is
> +being run as a resource for heartbeat, and thus started and stoped on
> +failover, then it probably is best to set this parameter to off and
> +start and stop the synchronisation daemons by other means.
> +
> +Note also that older kernels (<2.4.27?) can only run one daemon at a
time.
> +
> +The default is off
> +
> +
> B<quiescent = >[B<yes>|B<no>]
>
> If I<yes>, then when real or failback servers are determined @@
> -395,6 +414,7 @@
> $RUNPID
> $CHECKTIMEOUT
> $QUIESCENT
> + $SYNC_DAEMON
>
> $CALLBACK
> $CFGNAME
> @@ -1027,6 +1047,11 @@
> $LD_INSTANCE{$1} = 1;
> } elsif ($_ =~ /^supervised/) {
> $SUPERVISED = 1;
> + } elsif ($_ =~ /^sync_daemon\s*=\s*(.*)/) {
> + ($1 eq "on" || $1 eq "off" || $1 eq "master" ||
$1 eq "backup")
> + or &config_error($line,
> + "quiescent must be 'on', 'off',
'master' or 'backup'");
s/quiescent/sync_daemon/
> + $SYNC_DAEMON = $1;
> } elsif ($_ =~ /^quiescent\s*=\s*(.*)/) {
> ($1 eq "yes" || $1 eq "no")
> or &config_error($line, @@ -1422,6 +1447,7
> @@
>
> sub ld_setup
> {
> + ld_sync_start($SYNC_DAEMON);
> for my $v (@VIRTUAL) {
> if ($$v{protocol} eq "tcp") {
> $$v{proto} = "-t"; @@ -1683,6 +1709,8 @@
> &system_wrapper("$IPVSADM -D $$v{proto} " .
&get_virtual($v));
> &ld_log("Removed virtual server (stop): " .
&get_virtual($v));
> }
> +
> + ld_sync_stop($SYNC_DAEMON);
> }
>
>
> @@ -3602,3 +3630,103 @@
> {
> return ld_find_cmd_path($_[0], $ENV{'PATH'}, $_[1]); }
> +
> +# ld_sync_get_status
> +# Check the status of the ipvs sync daemon # pre: type: "backup" or
> +"master"
> +# return: PID of running sync daemon
> +# undef otherwise
> +sub ld_sync_get_status
> +{
> + my ($type) = (@_);
> + my $status = 0;
> +
> + open PS, "ps ax|" or return;
> +
> + while(<PS>) {
> + m/ \[ipvs[ _]sync$type\]$/ or next;
> + s/ *//;
> + s/ .*$//;
> + $status = $_;
> + last;
> + }
> +
> + close PS;
> + return $status;
> +}
> +
> +# __ld_sync_stop
> +# Run the ipvs sync daemon if it is not already running, else do
> +nothing # pre: type: "backup" or "master"
> +# return: none
> +sub __ld_sync_stop
> +{
> + my ($type) = (@_);
> + my $result;
> +
> + if (not ld_sync_get_status($type)) {
> + $result = "skipped (not running)";
> + }
> + elsif (system_wrapper("ipvsadm --stop-daemon $type") != 0) {
> + $result = "fail";
> + }
> + else {
> + $result = "ok";
> + }
> + ld_log("Stopping ipvs sync$type: $result"); }
> +
> +# ld_sync_stop
> +# Stop the ipvs sync daemons using __ld_sync_stop() # pre: type:
> +"off", "on", "backup" or "master"
> +# return: none
> +sub ld_sync_stop
> +{
> + my ($type) = (@_);
> +
> + if ($type eq "on" or $type eq "master") {
> + __ld_sync_stop("master");
> + }
> + if ($type eq "on" or $type eq "backup") {
> + __ld_sync_stop("backup");
> + }
> +}
> +
> +# __ld_sync_start
> +# Stop the ipvs sync daemon if it is running, else do nothing # pre:
> +type: "backup" or "master"
> +# return: none
> +sub __ld_sync_start
> +{
> + my ($type) = (@_);
> + my $result;
> +
> + if (ld_sync_get_status($type)) {
> + $result = "skipped (already running)";
> + }
> + elsif (system_wrapper("ipvsadm --start-daemon $type") != 0) {
> + $result = "fail";
> + }
> + else {
> + $result = "ok";
> + }
> + ld_log("Starting ipvs sync$type: $result"); }
> +
> +
> +# ld_sync_start
> +# Stop the ipvs sync daemons using __ld_sync_start() # pre: type:
> +"off", "on", "backup" or "master"
> +# return: none
> +sub ld_sync_start
> +{
> + my ($type) = (@_);
> +
> + if ($type eq "on" or $type eq "master") {
> + __ld_sync_start("master");
> + }
> + if ($type eq "on" or $type eq "backup") {
> + __ld_sync_start("backup");
> + }
> +}
> +
> Index: ldirectord.cf
> ===================================================================
> RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.cf,v
> retrieving revision 1.26
> diff -u -r1.26 ldirectord.cf
> --- ldirectord.cf 5 Aug 2005 06:18:17 -0000 1.26
> +++ ldirectord.cf 5 Jul 2006 09:16:17 -0000
> @@ -16,6 +16,7 @@
> #logfile="/var/log/ldirectord.log"
> #logfile="local0"
> quiescent=yes
> +sync_daemon=off
Cheers mate,
Roberto Nibali, ratz
--
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com fax://++41 62 823 9356
-------------------------------------------------------------
10 Jahre Kompetenz in IT-Sicherheit. 1996 - 2006
Wir sichern Ihren Erfolg. terreActive AG
-------------------------------------------------------------
|