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 folder 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 folder to control whether, in the event of a failover condition, the secondary server acquires the primary server’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 nonzero 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 folder named with your primary server IP address, and then change the name of the script to Test. This script always returns a nonzero 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 (pre acquisition), after acquiring the IP address (post acquisition), before relinquishing the primary IP address (pre relinquish), and after relinquishing the IP address back to the primary server (post relinquish). These scripts reside in the /Library/IPFailover/IP_address folder on the secondary server. The scripts use these four prefixes:

ÂPreAcq—Run before acquiring the IP address from the primary server

ÂPostAcq—Run after acquiring the IP address from the primary server

ÂPreRel—Run before relinquishing the IP address back to the primary server

ÂPostRel—Run after relinquishing the IP address back to the 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 in which their file names appear in a folder listing using the ls tool.

Chapter 14 Working with Network Services

247

Page 247
Image 247
Apple Mac OS X Server manual Configuring IP Failover, Notification Only, Pre and Post Scripts