You are on page 1of 2

Cloning with minimal downtime on AEM6.

x
Detailed steps on how to clone an instance with minimal downtime.
Instance1: the good instance that you want to clone located on server1
Instance2: is the bad instance that you to replace located on server2

Cleanup before cloning (optional)


Logs cleanup
If you have a large logs directory then consider backing that up and then deleting some older
logs
1. Copy ../crx-quickstart/logs directory to a backup location on both instances
2. In the logs directory, delete all old logs, keep only the ones without dates
Refer to the Maintenance activities docs to run the following activities:

1. Workflow purge
2. Audit purge
3. Version purge
4. Revision Cleanup
5. Datastore cleanup

Start the cloning process


MongoMK environment
Usually MongoMK is used when you have a cluster topology which means that the repository is shared amongst either

AEM authors or publishers. In case of a MongoMK environment with a cluster, all you need to do is to unpack the AEM jar file

so that crx-quickstart directory is created. Once unpacked, just start the instance.

Ex: java -jar aem.jar –unpack

TarMKPreparationenvironmentonInstance1

1. While Instance1 is running, you can copy the crx-quickstart directory using the rsync command from
server1 to a directory on server2 called crx-quickstart_new (It is supposed to be at the same level of
the current crx-quickstart directory on server2). The idea is to do as much copy iterations as you can
before you shutdown so that your downtime is minimal.
2. If your Blob Store is a FileDataStore then you need to sync the datastore directory too. Create a
directory to copy the datastore content.
3. First copy will take some time to finish depending on the size of the instance, the second time will take seconds and the

third time will take less than a second. You can use this sample rsync command

for copying.
Example: rsync -vaz --delete --exclude "logs" --exclude "repository/version/index_*.tar" --exclude "repository/.lock" --
exclude "workspaces/crx.default/index_*.tar" --exclude "repository/tarJournal/index_*.tar"
username@remoteServerName:/prd/day/cq5/author/crx-quickstart /prd/day/cq5/clone-author | tee log.txt

4. Run the rsync command 3 times for the crx-quickstart and datastore directories
5. Shutdown Instance1
6. Do another rsync
7. Start Instance1
Preparation on Instance2

1. If your Blob Store is a FileDataStore then you need to point AEM to the new datastore directory. Open (../crx-

quickstart_new/install/org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.config) and change the path

property to point to the new datastore location. Do the same for FileDataStore.config under ( ../crx-

quickstart_new/launchpad/config/org/apache/jackrabbit/oak/plugins/blob/datastore)

2. Search for sling.id.file under (../crx-quickstart_new/launchpad/felix) and delete it. You will find it in one of
the bundle directory.
3. Delete (../crx-quickstart_new/ logs) directory
4. Rename crx-quickstart to crx-quickstart_old
5. Rename crx-quickstart_new to crx-quickstart
6. Start Instance2
7. Go to CRXDE Lite and delete the (/var/discovery) node
8. At this point you will notice some warning messages in the error.log such as “No discovery info available”. This is

because the “Apache Sling Resource-Based Discovery Service” has stopped.

9. Login to the OSGI Console and start the “Apache Sling Resource-Based Discovery Service” bundle.

10. Restart Instance2

You might also like