Web Farm Synchronisation not working

vishal vazkar asked on December 23, 2015 12:28

Hello,

We are having an issue of synchronising files on our project which has been setup on 2 servers using web farm database requests.

The custom function which we have written does the following:

  1. FTP into the client server
  2. Pull down all the latest media files
  3. save all the Media files on to the media library using the following function:
var mediaFile = new MediaFileInfo(location, library.LibraryID)
            {
                FileName = cmsFile.Name,
                FileTitle = cmsFile.Name,
                FileDescription = cmsFile.Name,
                FilePath = toUpload,
                FileExtension = cmsFile.Extension,
                FileMimeType = string.Format("image/{0}", cmsFile.Extension),
                FileSiteID = siteInfo.SiteId,
                FileLibraryID = library.LibraryID,
                FileSize = cmsFile.Length
            };

            MediaFileInfoProvider.ImportMediaFileInfo(mediaFile);

the result of this function stores the Media files which have been retrieved via FTP on the file system and a database record is created. This also appears on the administration desk but "ONLY" for the server which the file was stored on, and does not synchronise these files to the 2nd server.

This is fairly urgent as we have the client entering content on these sections and don't want the servers to be out of sync.

is there a specific reason why this is happening ? The Web Farm is using the "Use Web Farm Database Updater" functionality to synchronise the 2 servers and works fine when manually uploading any media from the CMSDesk. Do I need to write a custom sync task for this function which I have created ?

Thanks, Vishal

Recent Answers


Brenden Kehren answered on December 23, 2015 14:08

Have you told your code to create a sync task? I'm not 100% sure it does it through the API automatically. So you might look into the WebFarmTaskInfo and WebFarmTaskInfoProvider classes to do that.

2 votesVote for this answer Mark as a Correct answer

vishal vazkar answered on December 23, 2015 14:37

Hi Brenden,

thanks for the update. No we have not yet written any custom sync task as we were expecting that kentico would pick this up on a change in the database. Our current process updates the database with the latest media values.

We are having a look into custom synchronisation tasks and thinking of adding this in if this is definately the reason the sync is failing.

Thanks, Vishal

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 23, 2015 14:48

You might also check these two things:

  1. If you have manually setup your servers, make sure the servers are properly defined. If you're using automatic, make sure there are no errors with the web farm tasks and/or there aren't any stray web farm tasks left over or stuck in the queue.
  2. In Settings>Web farm & Synchronization>Allow synchronization of and make sure Media Files is checked.
1 votesVote for this answer Mark as a Correct answer

vishal vazkar answered on December 23, 2015 14:53

I usually check this and the web farm links and can confirm that this is working and the check box is checked. The only thing that is left to test is adding the custom sync task.

The logs under the Web Farm > Tasks / Anonymous tasks are clear which is making me feel that there is no problem in the synchronisation of the servers.

I will keep you updated. Please let me know if there is anything else you think might be the cause for this.

Thanks, Vishal

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.