Elasticsearch Snapshot Synchronization

You can use the Elasticsearch Snapshots to keep in Sync two or more EnterMedia instances. Following the instruction to Export/Import an instance in the Docker way, make a initial replica of the Main Instance.

Now you need to set up a cron-job to sync the repos path in the elastic folder. Default repos path could be found at: /media/emsites/my_site/elastic/repos/.

Sample rsync script for pulling repos into destination Instance:

 rsync -azhi --progress --delete mainserver.net:/media/emsites/my_site/elastic/repos/ /media/emsites/my_site/elastic/repos/

You can schedule a cron-job to run hourly: 0 * * * * /home/entermedia/scripts/sync-repos.sh

In your main instance you will need to Schedule the Snapshots to run every hour or less. In the destination instance you will need to enable and schedule the event name Restore newest snapshots under the Utils category. Schedule this event right after the cron-job ends with the sync.

Keep in mind this will restore the Snapshot of the data base but will not include media (Originals and Generated). You will need to sync those files directly.

Sample rsync for pulling media into destination Instance:

 rsync -azhi --progress --delete mainserver.net:/media/emsites/my_site/data/assets/catalog/ /media/emsites/my_site/data/assets/catalog/