152

Configuring IP Failover

You configure failover behavior using scripts. The scripts must be executable (for example, shell scripts, Perl, compiled C code, or executable AppleScripts). You place these scripts in /Library/IPFailover/<IP address> on the secondary server.

You need to create a directory named with the public IP address of the primary server to contain the failover scripts for that server. For example:

/Library/IPFailover/100.0.0.10

Notification Only

You can use a script named “Test” located in the failover scripts directory to control whether, in the event of a failover condition, the secondary server acquires the primary’s IP address, or simply sends an email notification. If no script exists, or if the script returns a zero result, then the secondary server acquires the primary’s IP address. If the script returns a non-zero result, then the secondary server skips IP address acquisition and only sends email notification of the failover condition. The test script is run to determine whether the IP address should be acquired and to determine if the IP address should be relinquished when the primary server returns to service.

A simple way to set up this notification-only mode is to copy the script located at /usr/bin/false to the directory named with your primary server IP address and then change the name of the script to “Test”. This script always returns a non-zero result.

Using the Test script, you can configure the primary server to monitor the secondary server, and send email notification if the secondary server becomes unavailable.

Pre and Post Scripts

You can configure the failover process with scripts that can run before acquiring the primary IP address (preacquisition), after acquiring the IP address (postacquisition), before relinquishing the primary IP address (prerelinquish), and after relinquishing the IP address back to the primary server (postrelinquish). These scripts reside in the /Library/IPFailover/<IP address> directory on the secondary server, as previously discussed. The scripts use these four prefixes:

PreAcq – run before acquiring IP address from primary server

PostAcq – run after acquiring IP address from primary server

PreRel – run before relinquishing IP address back to primary server

PostRel – run after relinquishing IP address back to primary server

Important: Always be sure that the primary server is up and functioning normally before you activate IP failover on the secondary server. If the primary server isn’t sending broadcast messages, the secondary server will initiate the failover process and acquire the primary’s public IP address.

You may have more than one script at each stage. The scripts in each prefix group are run in the order their file names appear in a directory listing using the ls command.

Chapter 13 Working With Network Services

Page 152
Image 152
Apple oxs manual Configuring IP Failover, Notification Only, Pre and Post Scripts