5.6. Site Sync¶
Ngenea Hub provides the facility for syncing data from one site to another.
Site Sync applies changes in one direction. See also Bidirectional Site Sync for applying changes in both directions.
Synchronisation is achieved by utilising a scheduled workflow which periodically discovers file and directory changes within an Independent Fileset on a source site and applying those changes to a target site. Changes are applied by sending newly created or recently modified files and directories, including deleting or moving files or directories in place on the target site as necessary to match the source site.
The following walkthrough details how to set up a sync between two sites ('Site Sync') using the Ngenea Hub UI.
The REST API can also be utilised to achieve the same setup.
5.6.1. Schedule¶
A schedule defines when and how often a sync occurs.
In the Ngenea Hub UI, navigate to the Administration
page, and select the Schedules
tab.
To create a new schedule, click the Add
button.
Configure the schedule by entering appropriate details into the Add new schedule
dialog:
Enter a descriptive
Name
for the schedule, E.G. "sync-to-site2"Select the
source
site from the dropdown menuSet the
Discovery
tosnapdiff
. Snapdiff discovery uses snapshots to track changes over time within an Independent Fileset.Set the
Path
to the top level directory (path) of the Independent Fileset to be synchronisedSet the time criteria
Click the
Add
button to add the new schedule
Time criteria
A schedule utilises cron syntax. By default, all the fields are populated with *
- this means the schedule will run every minute. This is likely too frequent as the calculation of file changes could take longer than the time between the schedule running every minute. Sizing for an ideal setup will balance the need to sync files quickly versus how long the sync snapdiff stage takes to run. This can be most effectively achieved through observation.
Examples:
To enact the schedule every 5 minutes, specify the
Minute
field as follows:*/5
.To enact the schedule once an hour, set the
Minute
field to a number of minutes past the hour. SettingMinute
to5
will run the sync once an hour at 5 minutes past the hour.To enact the schedule at set times throughout the hour, change the
Minute
field separating entries by commas (E.G.)7,23,46
5.6.2. Workflow¶
Schedules enact a workflow. A workflow performs one or more series of tasks to files and/or directories.
In the Ngenea Hub Hub UI, navigate to the Administration
page, and select the Schedules
tab.
Select the prior created schedule in the Schedules
tab, which then displays the Schedule Details
page.
Subscribing a workflow
To associate a workflow with a schedule undertake the following actions:
Click
Subscribe
and in the create dialogue setSite
to the source site from which to synchronise.
Ngenea Hub provides a built-in workflow for synchronising changes from an Independent Fileset on a source site to a target site.
Select
Sync Fileset to Site
from theWorkflow
dropdown menu.
Configure the workflow subscription settings by entering appropriate details into the Subscribe workflow to schedule
dialog:
Select the target site in the
Destination site
Select an appropriate
Sync Policy
Click
Subscribe
to associate the workflow to the schedule
Sync Policy
The Sync Policy
setting controls how conflicts are resolved. A conflict may occur if (E.G.) different versions of the same file exist on both source and target sites. By default, the newest version of the file will be retained.
Outcome
Now associated (subscribed), files and/or directories will synchronise at the next scheduled execution time. When executing the scheduled workflow, two jobs appear within the schedule details page. One for the snapdiff discovery, and one for the subscribed sync workflow.
The first enactment of the sync will synchronise all files and directories in the Independent Fileset from the source site. Further enactments will synchronise files and/or directories created, modified, deleted or moved since the last enactment and the time of the most recent enactment.
5.6.3. Additional Options¶
Associating more than one workflow to the same schedule can be utilised to synchronise from the same source site to another target site. Additional workflows cause creation of an additional job, and run simultaneously with other syncs enacted from the same schedule.
5.6.4. Troubleshooting¶
If you encounter issues with sync, refer to the sync troubleshooting guide page for guidance.