AEM PreUpgrade Tasks and Activites


Pre-Upgrade Maintenance Tasks

Follow below maintenance tasks to ensure that the system is ready & it can be rolled back if any issues occur:
v  Ensure Sufficient Disk Space
v  Fully Back Up AEM
v  Back Up Changes to /etc
v  Generate The quickstart.properties File
v  Configure Workflow and Audit Log Purging
v  Install, Configure, and Run The Pre-Upgrade Tasks
v  Disable Custom Login Modules
v  Remove Updates From The /install Directory
v  Stop Any Cold Standby Instances
v  Disable Custom Scheduled Jobs
v  Execute Offline Revision Cleanup
v  Execute Datastore Garbage Collection
v  Upgrade the Database Schema If Needed
v  Delete Users that Might Hinder the Upgrade
v  Rotate Log Files

Ensure Sufficient Disk Space
                     When executing the upgrade, in addition to the content and code upgrade activities, a repository migration will need to be performed. Migration will create a copy of the repository in the new Segment Tar format. As a result, we need enough disk space to retain a second, potentially larger, version of your repository.

Fully Back Up AEM
                    AEM should be fully backed up before beginning the upgrade. Make sure to back up your repository, application installation, data store, and Mongo instances if any applicable.

Back Up Changes to /etc
                  Upgrade process does maintaining and merging existing content and configurations from under the /apps and /libs paths in the repository.  For changes made to the /etc path, including Context Hub configurations, it is necessary to re-apply these changes after the upgrade. While upgrade will make a backup copy of any changes that it cannot merge under /var, its recommend to back up these changes manually before beginning the upgrade.

Generate the quickstart.properties File
                   When starting AEM from the jar file, a quickstart.properties file will be generated under crx-quickstart/conf. If AEM has been started with the start script in the past, this file will not be present and the upgrade will fail. Make sure to check for the existence of this file and restart AEM from jar file if it is not present.

Configure Workflow and Audit Log Purging
                     The WorkflowPurgeTask and com.day.cq.audit.impl.AuditLogMaintenanceTask tasks require separate OSGi configurations and will not work without them. If pre-upgrade task execution fail, missing configurations is likely the reason. So make sure to add OSGi configurations for these tasks.

Install, Configure, and Run The Pre-Upgrade Tasks
            Pre-upgrade maintenance tasks that before had to be performed manually are being optimized and automated. Pre-upgrade maintenance optimization added to AEM 6.3 enables a unified way to trigger these tasks and be able to inspect their result on demand.
All tasks included in the pre-upgrade optimization step are compatible with all versions from AEM 6.0 onwards.

For upgrading from AEM 6.2
  Download and install the package pre-upgrade-tasks-content-cq62-1.2.4 on the instance to be upgrade. Default Configuration of the Pre-Upgrade Health Checks – Ran runAllPerUpgradeTasks() method

How to Use It
          The PreUpgradeTasksMBean OSGI component comes preconfigured with a list of pre-upgrade maintenance tasks that can be run all at once. You can configure the tasks by following the below procedure:
Go to the Web Console http://serveraddress:serverport/system/console/configMgr
Search for "preupgradetasks", then click on the first matching component, name is com.adobe.aem.upgrade.prechecks.mbean.impl.PreUpgradeTasksMBeanImpl.
Modify the list of maintenance tasks that need to run as shown below:

1487758925984

Default Configuration of the Pre-Upgrade Health Checks
              Access the MBeans by going to the JMX Console http://serveraddress:serverport/system/console/jmx
         Search for PreUpgradeTasks and click it. Select any method from the Operations section and select Invoke like in below window.
runAllPreUpgradeTasks()
ACTION
Runs all the pre-upgrade maintenance tasks in the list.

Remove Updates From The /install Directory
              Remove any service packs, feature packs or hotfixes that have been deployed through the crx-quickstart/install directory on the local file system. This prevent the inadvertent installation of old hotfixes and service packs on top of the new AEM version after the update has completed.

Stop Any Cold Standby Instances
              Using TarMK cold standby, stop any cold standby instances. These guarantee an efficient way to come back online in case of issues in the upgrade.
After the upgrade has completed successfully, the cold standby instances will need to be rebuilt from the upgraded primary instances.

Disable Custom Scheduled Jobs
               Disable any OSGi scheduled jobs that are included in your application code.

Created Purge configs for Workflow and Audit Logs


Run tar offline compaction process
Run below compaction commands as part of pre-upgrade maintenance tasks to compact the repository.

Check for Check points that needs to be deleted in later command.
        java -jar oak-run.jar checkpoints installPath /crx-quickstart/repository/segmentstore

Next, delete the unreferenced checkpoints
        java -jar oak-run.jar checkpoints  installPath/crx-quickstart/repository/segmentstore rm-all

Final step is to run the compaction and wait for it to complete (tail the logs!)
       java -jar oak-run.jar compact installPath /crx-quickstart/repository/segmentstore

Download respective oak-run jar version, based on version of AEM being used.

Unpack AEM 6.5 jar.
              After successfully completion of pre-upgrade tasks run below command by placing AEM 6.5 jar under 6.2 folder & unpack 6.5 version by using below command.
java -Xmx4096m -jar AEM_6.5_Quickstart.jar –unpack


Now need to run below command to change repository to segment tar
java -Xmx4096m -XX:MaxPermSize=2048m -jar AEM_6.5_Quickstart.jar -v -x crx2oak -xargs -- --load-profile segment-no-ds

Use name of crx2oak jar and place it under ‘crx-quickstart\opt\extensions’ - crx2oak-1.10.0-all-in-one, use name of crx2oak in the command.


Note: For file system data store we need update the node profile, refer link for more info.

After completion of above command below log is thrown in command prompt.

To complete migration you need to manually move the following files in the following order:
                                                Source |  Operation |                                        Destination
    ...192_HEAP\crx-quickstart\repository\segmentstore | -- MOVE -> | ...\crx-quickstart\repository-crx2oak-backup-20...
    ...\crx-quickstart\repository-segment-tar-20191... | -- MOVE -> | ...192_HEAP\crx-quickstart\repository\segmentstore

Under UNIX you can try with the following commands:
    mv crx-quickstart\repository\segmentstore crx-quickstart\repository-crx2oak-backup-20191115-130058\segmentstore
    mv crx-quickstart\repository-segment-tar-20191115-130044\segmentstore crx-quickstart\repository\segmentstore

  Under Windows you can try with the following commands:
    move crx-quickstart\repository\segmentstore crx-quickstart\repository-crx2oak-backup-20191115-130058\segmentstore
    move crx-quickstart\repository-segment-tar-20191115-130044\segmentstore crx-quickstart\repository\segmentstore

Now Start AEM 6.5.

It starts with new segment tar repository & also it performs re-indexing. Wait to see below message in log.
        “org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing completed

Navigate to product information console to see the product version

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDQ62GEEOE9Pa9CtgSR1S6wdjt6Hz0pgfCwqM4p3TAvnKTeTVE-6nhEmepOuBX6g3HI5n7PE5eGy_rT3TdqYssNgo_-GBBLie5RiEWljrwux4cb_tXSc_ac40wK2Ax6nARbrVHdGo61C9y/s640/upgraded-aem64.png