6.6 Automated Synchronization

You can use MultiSite scripts and utilities to automate all phases of synchronization:

Use scheduled jobs to automate the export and transport phases, and use receipt handlers or scheduled jobs to automate the import phase. You can run the MultiSite scripts at any time and with any frequency, and you can vary the strategy for different VOBs by using multiple jobs.

By default, the MultiSite synchronization scripts place packets and shipping orders in the incoming and outgoing directories in the default storage bay, ccase-home-dir/shipping/ms_ship (UNIX) or ccase-home-dir\var\shipping\ms_ship (Windows). This bay is defined in the shipping.conf template file on UNIX and the MultiSite Control Panel on Windows.

The MultiSite scripts log their activity to files in the /var/adm/atria/log/sync_logs directory on UNIX and the ccase-home-dir\var\log directory on Windows.

Using the ClearCase Scheduler

ClearCase installation adds three preconfigured jobs to the scheduler: Daily MultiSite Export, Daily MultiSite Shipping Poll, and Daily MultiSite Receive. These jobs use the predefined MultiSite tasks: MultiSite Sync Export and MultiSite Sync Receive.

These jobs are disabled; to enable them, use the schedule -edit -schedule command or the graphical interface (Windows) and set the run times and other parameters appropriately:

NOTE: If you decide to use receipt handlers (see Import Phase), you do not need to enable the Daily MultiSite Receive job.

For information about creating new tasks and jobs and the prerequisites for using the scheduler, see the cleartool schedule reference page in the Command Reference and the Administrator's Guide for Rational ClearCase.

Export Phase

The script sync_export_list creates update packets. You can select the replicas to be updated, configure the script to send the packets immediately or place them in storage bays, and set other shipping options. For more information on the shipping options, see the sync_export_list reference page.

This job runs sync_export_list to generate and send updates to all other replicas in the VOB family at midnight local time:

Job.Begin
Job.Id: 17
Job.Name: "Sync Export Force ALL"
Job.Description.Begin:
Every midnight, for each replica on this host, export update packets to all sibling replicas.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.FirstStartTime: 00:00:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 13
Job.Args: -quiet 1 -all
Job.End

To put the packets in a storage bay, use the -ship option. Packets in storage bays are sent by the shipping_server. For example, this job runs sync_export_list to generate an update every day at 21:00 local time:

Job.Begin
Job.Id: 18
Job.Name: "Sync Export Store ALL"
Job.Description.Begin:
Every night at 9PM, for each replica on this host, generate update packets for all sibling replicas and store the packets in the storage bay.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.FirstStartTime: 21:00:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 13
Job.Args: -quiet 1 -ship -all
Job.End

See Transport Phase for information about running shipping_server.

Transport Phase

If sync_export_list or syncreplica puts packets in storage bays (-ship option), you must run shipping_server to process these packets. If you do not use -ship, but want to implement a retry-on-failure capability, you must schedule regular invocations of shipping_server. The shipping_server attempts to retransmit any outgoing packets that remain in any of the storage bays because one or more previous attempts have failed.

With the -poll option, sync_export_list invokes shipping_server -poll to process shipping orders located in all storage bays defined in the shipping.conf file (UNIX) or in the MultiSite Control Panel (Windows).

For example, this job invokes shipping_server every day at 04:00 local time:

Job.Begin
Job.Id: 19
Job.Name: "Shipping Server Poll"
Job.Description.Begin:
Every night at 4AM, run the shipping server to send any outstanding orders.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.FirstStartTime: 04:00:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 13
Job.Args: -quiet 1 -poll
Job.End

The following job implements a more aggressive retry-on-failure capability:

Job.Begin
Job.Id: 20
Job.Name: "Shipping Server Poll"
Job.Description.Begin:
Every half hour from midnight to 4AM, run the shipping server to send any outstanding orders.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.FirstStartTime: 00:00:00
Job.Schedule.StartTimeRestartFrequency: 00:30:00
Job.Schedule.LastStartTime: 04:00:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 13
Job.Args: -quiet 1 -poll
Job.End

Import Phase

To automate packet import, use one of the methods described in Table 11.

Table 11 Import Methods


Import method

Description

Advantages

Disadvantages

Receipt handlers


When a packet is received, the receipt handler imports it.


Packets are imported immediately.


Constant load on VOB server.


Scheduled jobs


When a packet is received at a replica, it is stored in a shipping bay. When the scheduled job runs, the packet is imported.


You can schedule import to minimize server load.


Changes are not applied to the VOB immediately.


Receipt handlers and scheduled jobs


See descriptions above.


You can use scheduled jobs to implement a retry-on-failure capability. For example, if packets are delivered out of order and the receipt handler cannot import them, the job retries the import.



Defining Receipt Handlers

On UNIX:

You can define receipt handlers in the shipping.conf file for different shipping classes. By default, no receipt handler is defined, but you can specify the sync_receive script as a receipt handler in the shipping.conf file:

RECEIPT-HANDLER -default /usr/atria/config/scheduler/tasks/sync_receive

For details about defining receipt handler entries, see the section RECEIPT HANDLER in the shipping.conf reference page.

On Windows:

You can define receipt handlers in the MultiSite Control Panel for different shipping classes. By default, no receipt handler is defined, but you can specify ccase-home-dir\config\scheduler\tasks\sync_receive.bat in the MultiSite Control Panel. To customize sync_receive.bat, copy it to a directory outside the ClearCase installation directory, customize it, and specify it in the MultiSite Control Panel.

For details about defining receipt handler entries, see the section Receipt Handler Path in the MultiSite Control Panel reference page.

Scheduling Import Jobs

The script sync_receive imports update packets. For more information on sync_receive options, see the sync_receive reference page.

This job runs sync_receive to import all packets in the incoming shipping bays of the current host at midnight local time:

Job.Begin
Job.Id: 15
Job.Name: "Sync Import ALL"
Job.Description.Begin:
Every midnight, import all update packets in incoming bays.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.FirstStartTime: 00:00:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 14
Job.End