Re: Using MON to Manage Web Server Failover

2004-04-21 Thread Dave Augustus
You could use heartbeat - it is made to do this very thing. I have used
it for 2 years- works great!

http://linux-ha.org/

Dave Augustus


On Wed, 2004-03-31 at 07:20, Doug Williams wrote:
> Hello all.  
> 
> I'm a newbie and am trying to figure out a way to use MON to perform
> automatic failover for a web server.  Has anyone done this or
> something similar?
> We have web servers in separate locations, but don't do anything fancy
> with load balancing - we simply want to switch to server "2" in the
> alternate location in the event of a failure of server "1".We
> would like this failover to happen through DNS, meaning that if server
> "1" does fail we would automatically change the A record in our zone
> master to point to server "2", and then update any secondary DNS
> servers with that change.  When server "1" is working again, the same
> process would happen in reverse.
> 
> I have http.monitor working but have now hit the wall.
> 
> Any suggestions?
> 
> Thanks for your time.
> 
> __
> ___
> mon mailing list
> [EMAIL PROTECTED]
> http://linux.kernel.org/mailman/listinfo/mon


signature.asc
Description: This is a digitally signed message part
___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread David Nolan


--On Wednesday, March 31, 2004 7:13 AM -0800 Jim Trocki 
<[EMAIL PROTECTED]> wrote:

the problem with the dns update method is that caches all around won't
expire the "dead" address for too long of a time.
True, assuming high TTLs on the records.  Given his design, I was assuming 
he was using low TTLs.

Though the problem still exists where web browsers may resolve the IP once 
and retain that IP internally until the browser exits.  The solution to 
this is to use the same IP on both machines, either via a method like you 
suggest, or a hardware load balancer, or an anycast solution.

-David

David Nolan<*>[EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
 a herd of rogue emacs fsck your troff and vgrind your pathalias!
___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread Fabien Salvi
Jim Trocki a écrit :
On Wed, 31 Mar 2004, David Nolan wrote:


Start by writing a stand alone script that can perform the change you need. 
I suggest using perl and Net::DNS::Update to send DDNS updates to your 
master.


the problem with the dns update method is that caches all around won't
expire the "dead" address for too long of a time.
this is a better-behaved method if you have a small number of web
servers all serving the same content on the same subnet:
1. each server has two ip addresses, one which is published in dns
   as an A record for "www.whatever.com", and the other is an
   "administrative" address. the published address is assigned to
   an alias interface, say eth0:1. the non-published address is
   not an alias.
2. when the web server boots, it ifup's the non-published address,
   but before configuring the published address on the alias
   interface it sends out a gratuitous arp for that address,
   and only configures it if it doesn't get a response (i.e.
   someone else isn't already using it). you can use "arping"
   to accomplish this:
	   http://www.gnu.org/directory/All_Packages_in_Directory/arping.html

if ! arping -q -D -c 5 -I eth0 ipaddr
then
# uh oh, some else is using that address on the subnet
fi
You could also look at fake :
http://www.vergenet.net/linux/fake/
It uses send_arp to prevent bad arp resolution if the failed server is 
still a bit alive (frozen but ping still ok, this happen frequently).

--
Fabien SALVI
___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread Jim Trocki
On Wed, 31 Mar 2004, David Nolan wrote:

> Start by writing a stand alone script that can perform the change you need. 
> I suggest using perl and Net::DNS::Update to send DDNS updates to your 
> master.

the problem with the dns update method is that caches all around won't
expire the "dead" address for too long of a time.

this is a better-behaved method if you have a small number of web
servers all serving the same content on the same subnet:

1. each server has two ip addresses, one which is published in dns
   as an A record for "www.whatever.com", and the other is an
   "administrative" address. the published address is assigned to
   an alias interface, say eth0:1. the non-published address is
   not an alias.

2. when the web server boots, it ifup's the non-published address,
   but before configuring the published address on the alias
   interface it sends out a gratuitous arp for that address,
   and only configures it if it doesn't get a response (i.e.
   someone else isn't already using it). you can use "arping"
   to accomplish this:

   http://www.gnu.org/directory/All_Packages_in_Directory/arping.html

if ! arping -q -D -c 5 -I eth0 ipaddr
then
# uh oh, some else is using that address on the subnet
fi

3. things run as normal, and mon checks http on the published
   web server addresses for failure. when a failure happens, a
   special alert script sshs over to one of the still-running web
   server's non-published addresses and ifup's the failed server's
   public address on another alias interface, say eth0:3.

this method is by no means the most robust, but it's reasonable if you
don't have the hardware to implement the proxy/load-balancer method.

i have the code which does all this, but it's not quite in a
nicely-packaged form. if someone is really interested i can probably
bundle it up.

___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread Jim Trocki
On Wed, 31 Mar 2004, Beat Jucker wrote:

> What about IP alias: the secondary web server could takeover 
> the IP address then you don't have to manipulate DNS records.

excellent idea! :)

___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread Beat Jucker
> I suggest using perl and Net::DNS::Update to send DDNS updates to your 
> master.  But if you're not using dynamic dns you'll need to come up with 
> your own way to do it.

Don't forget to define a low TTL for your web server else your original
server will still be cached for a while (default 3 days?).

What about IP alias: the secondary web server could takeover 
the IP address then you don't have to manipulate DNS records.

Regards
-- Beat

___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon


Re: Using MON to Manage Web Server Failover

2004-03-31 Thread David Nolan


--On Wednesday, March 31, 2004 8:20 AM -0500 Doug Williams 
<[EMAIL PROTECTED]> wrote:

I'm a newbie and am trying to figure out a way to use MON to perform
automatic failover for a web server.  Has anyone done this or something
similar?
We have web servers in separate locations, but don't do anything fancy
with load balancing - we simply want to switch to server "2" in the
alternate location in the event of a failure of server "1".We would
like this failover to happen through DNS, meaning that if server "1" does
fail we would automatically change the A record in our zone master to
point to server "2", and then update any secondary DNS servers with that
change.  When server "1" is working again, the same process would happen
in reverse.
I have http.monitor working but have now hit the wall.


Start by writing a stand alone script that can perform the change you need. 
I suggest using perl and Net::DNS::Update to send DDNS updates to your 
master.  But if you're not using dynamic dns you'll need to come up with 
your own way to do it.

Then modify that script such that when called by mon as an alert it'll 
update the record to your backup machine, and when called as an upalert 
it'll update the record back.

-David

David Nolan<*>[EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
 a herd of rogue emacs fsck your troff and vgrind your pathalias!
___
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon