Schedule File Synchronization Between Servers | JSCAPE
This post talks about the benefits of setting up automated file synchronization between two servers and how to do it using JSCAPE MFT Server.
If you want to go straight to the tutorial, scroll down to the section "Setting up scheduled file synchronization".
Why set up file synchronization?
File synchronization allows two servers to maintain updated copies of the same files. This can be quite useful for the following purposes:
1. To carry out remote backups in anticipation for disaster recovery
When you do file synchronization between two servers, files are going to be copied from one server to another. To give you an example, let's say you have two file transfer servers in an active-passive configuration.
Note: If you're not familiar with active-passive and active-active configurations, you might want to read "Active-Active vs Active-Passive High Availability Cluster" first.
Active-Passive server configuration
That means, while the primary server actively accepts uploads from clients, the secondary server does not. It just sits there doing nothing.
During synchronization, however, all new files and folders found on the primary are copied to the secondary as backups. So, if the primary server encounters a problem and becomes unavailable, the secondary server can immediately take its place. Since it already has copies of client-uploaded files, business operations can resume.
As you can see, file synchronization, especially one where the second server is located off-site, is great for disaster recovery purposes.
Note: Normally, file synchronization only refers to the copying of data files. Server configuration files are synchronized as a separate task. That task can be easily accomplished on JSCAPE MFT Server. If you're interested, you may check out the article How to Setup High Availability File Transfer Servers to see what we mean.
The example on that article actually uses an active-active configuration, as opposed to the active-passive configuration we recently discussed but the procedure for setting up is basically the same. That brings us to another benefit of file synchronization...
2. To support load-balanced, high availability services
When you have two servers in an active-active configuration load balanced for high availability services, it's important that the two servers maintain updated copies of the same files.
Active-Active server configuration
Otherwise, there'll be problems if an end user initially logs in to one server, uploads some files there, and then logs in to the second server in another session. That user won't be able to find those files he/she uploaded in the first server.
This happens if Server 1 goes down and files were't synchronized
To prevent this kind of problem, companies usually deploy a shared storage system behind the two servers.
That way, if one server goes down, clients will still be able to access the files they previously uploaded through the currently unavailable server.
Related post: Setting Up a NAS Shared Storage for Your File Transfer Servers
But what if you currently don't have the budget for shared storage? Well, if your file transfer server supports automated file synchronization, then you can set it up for that. Since files are synchronized, users will be able to access their files regardless which server they log in to.
A word of caution though. File synchronization between two active servers can be quite difficult to configure and can demand considerable computing resources. The recommended method is still to deploy a shared storage.
To obtain updated copies of files from a remote server and then access them locally
In some business processes, clients need to access locally stored files that are periodically updated from a remote server. While it's possible to configure a local file transfer server to download files from a remote server, a simple download operation might not be very efficient. To save bandwidth, the downloads must only involve newly added files or newly updated files. That's why an automated file synchronization would be more suitable for the job.
I'm sure you've learned enough to come up with your own use cases. We're now ready to proceed with the next step - learning how to set up a scheduled file synchronization process using JSCAPE MFT Server. For our example, let's try to meet the requirements of that last use case.
Setting up scheduled file synchronization
I'll assume you already have:
1. Two (2) servers with at least one of them running JSCAPE MFT Server.
2. An active Trading Partner running on JSCAPE MFT Server. If you don't know how to set up a Trading Partner, you may refer to these two posts:
Setting Up A Trading Partner For Automated FTP
Preparing Trading Partner Servers For SFTP Automation
Everything already set up? Let's proceed. Create a trigger and give a descriptive name (e.g. "Download New Files on TP1 Directory", wherein TP1 is just the name of our Trading Partner).
Select the Current Time event type and then click Next to proceed.
Click the Time Expression button to launch the Event Time Expression dialog window.
Once the Event Time Expression window pops-up, specify the time(s) when you want this file synchronization to execute. Let's say we want our servers to synchronize every Friday at 9pm. This is what you enter into the required fields:
After clicking OK, you should see that a corresponding expression is automatically generated for you. Click Next to proceed.
In the next window, click the Add button.
You can now select one of the synchronization trigger actions provided by JSCAPE MFT Server. As of this writing, there are four of these trigger actions. Two are for download and two are for upload. Two are for use with Trading Partners, while two aren't.
A download synchronization downloads updated copies of files from a remote server, while an upload synchronization uploads updated copies of files from the local server to a remote server.
What we need in this example is the "Trading Partner Directory Download Synchronization".
Click OK to proceed.
You'll then be asked to enter the required parameters for this trigger action. You'll need to:
- Select a Trading Partner.
- Specify a Source Directory. This is the directory on the remote server where you'll be copying files from. Note that this is a relative path that's based on the trading partner's home directory.
- Specify a Destination Directory. This is the directory on your JSCAPE MFT Server (the local server in this case) where downloaded files are going to be synchronized unto.
Notice that the Synchronization Mode is currently set to "Sync Timestamp". Let me explain how this works.
During synchronization, JSCAPE MFT Server will scan the source directory (found in the remote server) for files that aren't yet in the destination directory (found locally, in JSCAPE MFT Server). If any are found, it will consider those as newly added files and will promptly copy those files into the destination directory.
If, upon scanning, it comes acrosss a file that's already in both the source directory and the destination directory, it will compare the two copies based on whatever criteria is chosen in the Synchronization Mode.
If Sync Timestamp is chosen, JSCAPE MFT Server will compare the timestamps . If the timestamps of the two files are equal, it won't do anything. However, if the timestamps aren't the same, it will download the copy found in the source directory and overwrite the copy in the destination directory.
The other options are Sync Filesize and Sync Checksum. We'll discuss these three modes in a separate post.
You can leave the rest to their default settings for now.
Click OK until you're back at the main Triggers screen. Once you get there, don't forget to click the Apply button to finalize the trigger creation process.
That's it.
Get Started
Want to try this out yourself? Download a free, fully-functional evaluation edition of JSCAPE MFT Server now.