How to clone a TarMK instance in AEM
Quick steps to clone a TarMK instance in AEM by using rsync on Linux with AEM.
Description description
Environment
- Experience Manager
Issues/Symptoms
This article explains how to properly clone an AEM instance that uses TarMK (or TarMK + FileDataStore) for storage.
Resolution resolution
The steps below demonstrate how to copy an AEM + TarMK + FileDataStore instance using rsync on Linux with AEM installed under /mnt/aem/author.
-
Copy the full AEM instance to another server while it is running using a command like rsync. Make sure to preserve timestamps during the copy process and exclude the logs folder and datastore. For example:
rsync -av --exclude 'crx-quickstart/logs' --exclude 'crx-quickstart/repository/repository/datastore' /mnt/aem/author user@dest-host:/mnt/aem/
-
Stop AEM
-
Initiate another copy of the TarMK segmentstore folder to get any newer changes since the first copy was done:
rsync -av /mnt/aem/author/crx-quickstart/repository/segmentstore/* user@dest-host:/mnt/aem/author/crx-quickstart/repository/segmentstore/
-
Start AEM.
-
Copy the datastore while AEM is running. For example:
rsync -av /mnt/aem/author user@dest-host:/mnt/aem/crx-quickstart/repository/repository/datastore /mnt/aem/crx-quickstart/repository/repository/
-
On the destination server, re-create the logs folder, delete the crx-quickstart/repository/index folder, and delete the sling.id.file from the crx-quickstart/launchpad/felix folder.
mkdir /mnt/aem/crx-quickstart/logs
rm -rf /mnt/aem/crx-quickstart/repository/index
find /mnt/aem/crx-quickstart/launchpad/felix -type f -name "sling.id.file" -exec rm -f {} \; -print
-
On the destination server, start AEM and test your instance.
Important Note:
You must ensure that the datastore is copied after the segmentstore folder and that all timestamps are preserved during the copy. Rsync allows timestamps to be preserved with the -a option.