[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function call question.



Quoting Kekes Stamatis (skekes@kosmoslink.gr):
>  Hello everybody.
>  I'm writing a cross platform highavailability daemon like Linux's 
> heartbeat.
>  Does anybody know which function I must use in order to do:
> 
> 1) retrieve the network configuration ( IP address, IP Aliases )
> 2) set up an IP alias on a NIC ?

Back when I worked on a commercial HA project, we wrote a lot
of that in shell.  Why?  It was portable and fast enough, even
on 30MIPS machines.


The notion was to read from the config file (I'd use XML for it
now) to get the list of interfaces to check for life (generally at
least 3 - though Veritas' HA used to be able to "ping" over
SCSI if told the other machine's SCSI ID :)

The notion was "check for life on at least 2 interfaces, if some
fail, it's "degraded" - run the "degraded" actions.  If all fail,
it's "failed" the network.  Run that action.

Similar for shared disks being down. Required at least 2 paths
to the disks from *each* machine - so two disks on different
SCSI busses (with different cables).  One disk becomes unreachable,
run the "disk degraded" actions, both disks, run the "disk failed"
action.


For a failover, the public address presented was on a dedicated (pair of?)
network interfaces.  SunOS let us force the MAC address to our chosen
public MAC address via "ifconfig $if ether 8:0:20:ff:1:2" (or whatever).

It's done differently these days, I think.

But doing it via POSIX shell means that it can run on Linux, Solaris,
*BSD, etc, which minor per OS differences.  Perhaps "ifconfig" into
an OS specific AWK command would get you the info anywhere.


Doing it today, I'd find that perl was quite robust, but
politics dictated that we couldn't use perl since it didn't
ship.  I've since worked for companies that just put a tested
perl and apache and other tools build into the distribution.