Example: Setting up CDP Failover

Suppose you have a CDP Job called "Bills" with its master on computer SRC-LA and with a Server and slave Agent on computer BCKUP-SD, with an IP address of 192.168.0.1.

The following are complete setup instructions

  1. Deploy the Server on BCKUP-SD.

  2. Deploy a master Agent on SRC-LA and create a file backup Job Bills linked to BCKUP-SD. Your data is now continuously backed up to BCKUP-SD. SRC-LA is running an Agent in master mode.

  3. Deploy a backup Agent on BCKUP-SD and link to the Job using the Add this computer to an existing backup Job. Make sure the server is specified using its IP address (in this example, 192.168.0.1) and not the computer name. You now have a slave mode Agent cohosted with the Server on BCKUP-SD and connected to the Job Bills.

  4. On the Server computer BCKUP-SD, create a file C:\Availl_disconnected.bat with the following contents:

    REM We are passed three variables:

    REM %1 is this Job's name

    REM %2 is the location of this Job's data in the Vault

    REM %3 is the path for the Agent's executable, which we need in order to set its mode

    REM set this computer's cohosted Agent to master mode

    REM change this IP to the Availl Server's IP.

    %3 -setmode um "\\192.168.0.1\%1"

    REM log this event

    set logFile="C:\AD\_Logs\disconnect-log.txt"

    echo Master server disconnected at %DATE% %TIME% >> %logFile%

    echo Job: %1 >> %logFile%

    echo Vault: %2 >> %logFile%

    echo AvlAgt: %3 >> %logFile%

    echo. >> %logFile%

    REM as an easy way of popping up an alert, launch notepad with a defined message

    set messageFile="C:\AD\_Logs\message.txt"

    echo The master has just disconnected! > %messageFile%

    echo Setting cohosted Agent on this computer from Slave to Master. >> %messageFile%

    echo at %TIME% on %DATE%. >> %messageFile%

    notepad %messageFile%

    This sample switches the slave Agent that is cohosted on the server to master mode, makes a log of the switch and creates and opens a text file with a message to alert the administrator at the backup computer. Your script could contain e-mail notifications, DFS commands, or other actions to automate redirecting other computers to the new master.

  5. On the master computer SRC-LA, create a file C:\AVCStuff\srv_Disconnect.bat with the following contents:

    REM We are passed two variables:

    REM %1 is the name of the server we're disconnected from

    REM %2 is the reason why we were disconnected

    REM set this Agent to slave mode

    REM change this Job name to your Job's name

    C:\\AVCStuff\AvlAgt.exe -setmode us "\\192.168.0.1\Bills"

    REM log this event

    set logFile="C:\AVCStuff\disconnect-log.txt"

    echo Disconnected from server at %DATE% %TIME% >> %logFile%

    echo server: %1 >> %logFile%

    echo reason: %2 >> %logFile%

    echo. >> %logFile%

    REM as an easy way of popping up an alert, launch notepad with a defined message

    set messageFile="C:\AVCStuff\message.txt"

    echo We have just disconnected! > %messageFile%

    echo Setting Agent on this computer from Master to Slave. >> %messageFile%

    echo at %TIME% on %DATE%. >> %messageFile%

    notepad %messageFile%

  6. At the backup site, click the Server's icon in the taskbar to open the Server Console. Click Server > Manage Snapshots and Failover.

    db_snapshotfailover.gif

  7. Click the Job Bills in the Job list.

  8. Select the Enable auto-recovery after master Agent disconnect check box, and be sure that the Copy data into check box is cleared.

  9. In the text field next to Then run this script, type:

    C:\Availl_disconnected.bat

  10. Specify the appropriate number of seconds the master must be disconnected before the script is run; 120 is a good default. (You may want to set this to something very short initially, such as 5 seconds, so that testing the setup is quicker. Once you test the setup and see that it works, you can change this back to a more reasonable time.)

Your failover setup is now complete. Check both the master and slave Agents to make sure they are configured correctly by opening their Job Properties and Options dialog box and looking at the Change Options tab. They should both be set to CDP - continuous backup, and the cohosted Agent should be in slave mode, while the other is in master. You can test this by making a change to the linked folder on the master system and making sure that it is replicated at the cohosted Server/Agent system.

To test the failover

You must simulate an unexpected disconnect; just shutting down the master Agent service will not trigger failover. Two easy options for doing this are to disconnect the master Agent's network connection or to change the Server computer's firewall to block the Agent (e.g. blocking all activity on the Job's port, which is 80 by default).

Once the master has disconnected, wait the number of seconds specified in the Snapshots and Failure dialog box. A Notepad window should pop up on the server computer saying that its cohosted Agent has switched to master mode; go to its Job Properties and Options dialog box to confirm that this is the case.

Now reconnect the Agent and follow the instructions above to reestablish the original master and slave setup.