How to automate the Offline compaction process in AEM 6.2

Statement  : Automate the offline compaction process.


Solution :

  • For Offline compaction is still applicable for AEM 6.2 but AEM 6.3 is not required beacuse it spports online compaction.
  • Below is the steps involved in the automation and script which is used automates entire process.

Steps involved in the Offline compaction Automation :

  1. Shutdown AEM Server
  2. Use Matching Oak jar version to find Old Checkpoints
  3. Use Matching Oak jar version to Remove Unreferenced Checkpoints
  4. Use Matching Oak jar version to Compact Oak
  5. Restart AEM
SCRIPT:
#!/bin/bash
todayDate="$(date +'%d-%m-%Y')"
logfile="compact-$ todayDate.log"
installfolder="/data/aem"
aemfolder="$installfolder/crx-quickstart"
oakrun="$installfolder/help/oak-run-1.6.1.jar"

## Shutdown AEM
printf "Shutting down AEM.\n"
$aemfolder/bin/stop
todayDate ="$(date)"
echo "AEM Shutdown at: $ todayDate " >> $installfolder/help/logs/$logfile

## Find old checkpoints
printf "Finding old checkpoints.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile

## Delete unreferenced checkpoints
printf "Deleting unreferenced checkpoints.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore rm-unreferenced >> $installfolder/help/logs/$logfile

## Run compaction
printf "Running compaction. This may take a while.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun compact $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile

## Report Completed
printf "Compaction complete. Please check the log at:\n"
printf "$installfolder/help/logs/$logfile\n"

## Start AEM back up
todayDate ="$(date)"
printf "Starting up AEM.\n"
$aemfolder/bin/start
echo "AEM Startup at: $ todayDate " >> $installfolder/help/logs/$logfile

Reference :
https://jackrabbit.apache.org/oak/docs/command_line.html


3 comments:

  1. You will draw more loyal readers to your site
    and keep your readers coming back because you
    are sharing the best with them. They would try to make your site famous through social networking
    sites like my space, Facebook, Twitter, Digo, Digg, Delicious, etc as a part
    of their SEO services London. Whether you promote yourself as a solo or business brand (< learn 10 ways to improve your SEO with Google+) Google+ is now a necessity.

    ReplyDelete
  2. He forms the enjoyable and informative articles related to Web Design Company and SEO Company in the
    UK. By using the data from Google Adwords, SEO company London experts can match keywords that
    they want to target and are specific. Whether you promote yourself as a solo or business brand (< learn 10 ways to improve your SEO with Google+) Google+ is now a necessity.

    ReplyDelete
  3. This gives a website web presence and it gives you a major advantage over your competition. Each of the images on your web site should really have proper detailed titles and alt tags too.
    Taking a look at other company's websites within a particular niche field can clue you in to what's being actively searched
    for, and what's not.

    ReplyDelete