March 28, 2020
Estimated Post Reading Time ~

AEM Pre Upgrade tasks and activities

Pre-Upgrade Maintenance Tasks
Follow below maintenance tasks to ensure that the system is ready & it can be rolled back if any issues occur:
  1. Ensure Sufficient Disk Space
  2. Fully Back Up AEM
  3. Back-Up Changes to /etc
  4. Generate The quickstart.properties File
  5. Configure Workflow and Audit Log Purging
  6. Install, Configure, and Run The Pre-Upgrade Tasks
  7. Disable Custom Login Modules
  8. Remove Updates From The /install Directory
  9. Stop Any Cold Standby Instances
  10. Disable Custom Scheduled Jobs
  11. Execute Offline Revision Cleanup
  12. Execute Datastore Garbage Collection
  13. Upgrade the Database Schema If Needed
  14. Delete Users that Might Hinder the Upgrade
  15. 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. The 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, datastore, and Mongo instances if applicable.

Back-Up Changes to /etc
The upgrade process does maintain and merge 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 the upgrade will make a backup copy of any changes that it cannot merge under /var, it's recommended to back up these changes manually before beginning the upgrade.

Generate the quickstart.properties File
When starting AEM from the jar file, a quick start.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 the 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 fails, missing configurations are 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 upgraded. 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 "pre-upgrade tasks", then click on the first matching component, the name is com.adobe.aem.upgrade.prechecks.mbean.impl.PreUpgradeTasksMBeanImpl.
Modify the list of maintenance tasks that need to run as shown below:

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 the below window.

runAllPreUpgradeTasks()
ACTION
Runs all the pre-upgrade maintenance tasks on 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 prevents the inadvertent installation of old hotfixes and service packs on top of the new AEM version after the update has been 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 been 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
https://blogs.perficientdigital.com/2017/09/14/aem-6-3-when-runallpreup-gradetask-fails/

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

Check for Checkpoints that need to be deleted in later command.
java -jar oak-run.jar checkpoints install path /crx-quickstart/repository/segmentstore

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

The 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 the respective oak-run jar version, based on a version of AEM being used.

Unpack AEM 6.5 jar.
After successfully completing pre-upgrade tasks run the below command by placing AEM 6.5 jar under the 6.2 folder & unpack the 6.5 version by using the 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 the name of crx2oak jar and place it under ‘crx-quickstart\opt\extensions’ - crx2oak-1.10.0-all-in-one, use the name of crx2oak in the command.

Note: For file system data store we need to update the node profile, refer to the link for more info.
https://helpx.adobe.com/experience-manager/6-5/sites/deploying/using/in-place-upgrade.html

After completion of the above command below log is thrown in the 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 at AEM 6.5.
It starts with a new segment tar repository & also it performs re-indexing. Wait to see the below message in the log.
“org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing completed”

Navigate to the product information console to see the product version

References:
https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/pre-upgrade-maintenance-tasks.html
https://helpx.adobe.com/experience-manager/6-5/sites/deploying/using/in-place-upgrade.html



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.