in reply to CGI script on cluster server

If you want failover, then you probably need to look at an external program to manage that. Heartbeat is one such program.
This handles one server freezing, crashing, etc.

Unfortunately this isn't much help for you, as I don't think it runs on Windows yet.
MS has a clustering solution, but it's only on Win2k Advanced Server.

Unless you're already running advanced server, and can write a COM+ perl script, then your best solution may be to take the ideas of heartbeat and adapt them to your script.
Open up a TCP socket, and have the programs ping each other back and forth. Typically the secondary will ping the primary. If the primary doesn't respond, then the secondary should take over.

A few issues to watch out for:
Primary Stops (crashes or freezes or program dies)
Primary Stops, but comes back up after secondary takes over (secondary needs to stop, or primary needs to realize that they have switched roles)
Depending on the application, you will have to make sure that the switch from primary to secondary is invisible to the user, this usually involves ip address changes or dns tricks.

Replies are listed 'Best First'.
Re: Re: CGI script on cluster server
by chaoticset (Chaplain) on Jul 11, 2003 at 17:56 UTC


    Open up a TCP socket, and have the programs ping each other back and forth. Typically the secondary will ping the primary. If the primary doesn't respond, then the secondary should take over.
    Actually, couldn't you write a different script that does the pinging, and then fires up the needed process on one system or the other?

    They'd each be identical. If the process was running, no new action. If the process isn't running, ping the identical script on the other machine. If the other machine's not there, start the process on the current machine.

    If they were both running at once, one had to start, and if that one started, then the process is running. Each freezes current working data in a known location, and if the process fails for one, then it tells the other to start its process up with the working data. If the process gets no ping and no process is running, it looks in the known place for the last set of working data and uses that. If there's no last set, it just starts the process.

    Just my $0.02...

    -----------------------
    You are what you think.