Using replication

About Replication

Replication allows one-way data synchronization between two Saurus CMS websites. New items, updates and content removals will be mirrored from master site to slave site. Replication can be defined per site language or site sub tree so you can keep whole sites in sync or replicate only part of the sites. The data should always be moved in one way from master site to slave.

How to use

To execute replication, you need to:

  • Define data export in one CMS and data import in another.
  • Run replication process in both sites using cron, see below.
  • Move binary files created by export process to target site for importing using FTP client.

Creating import/export process in CMS

  • Go to Admin > Integration > Replication.
  • Click new.
  • Type: choose whether you are importing or exporting data from this CMS.
  • Scope: leave it to “Subtree of section”.
  • Name: insert human readable name such as “All English content” or “News”.
  • Section: choose the section you would like to export or import to. In case you are replicating multiple languages, you need to create separate processes for each of them.
  • Subtree: specify whether you are exporting only objects in give section level or the whole tree.
  • Objects: which type of content objects are replicated. Usually you do not need to change this, leave them all selected.
  • Filename / URL: this refers to the physical file where the replication data is saved or read from. Enter full path from server root with a filename, also make sure Apache can read and/or write it.
  • Request method: usually you are dealing with files on the filesystem, so leave it to FILE.
  • Time interval: minutes between the replication process should run. In most cases you will run the process using cron, but if you do not, it will run on page load.
  • Active: whether this process is included when run from cron or page load.
  • Target site actions: which actions should replicate. For example if you uncheck Delete, then content removals from first site are not committed in target site. Usually you should leave them all checked.
  • Publishing: Default means objects in target site will have same publishing state as in source site. Other two options force publish or hide for each replicated objects.

Running Replication import/export from cron

By default, the Replication import/export is executed during pageload. To run the import/export from cron, add the following line in your crontab:

*/10 * * * * cd /path/to/website/admin/;
/usr/local/bin/php auto_replication.php > /dev/null

Change the number of minutes, in the example 10, and correct path to the website and PHP executable.