Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Two AEM instances Comparision

Avatar

Community Advisor

Hi All,

We have a requirement where we need to compare two AEM intances and extract the differences and also export the metadata(such as content name,type,size) of a jcr repository and hierarchical susbset.

1.  Is their any tool which will do this comparision.

2. Is their best ways to do it.

10 Replies

Avatar

Level 10

Hi Manikumar,

Yes there is one Helpx article which tells on compare content and import tool - to compare and import content differences from one CQ instance to another CQ instance.

Check here for the same: https://helpx.adobe.com/experience-manager/kb/contentcompareimport.html - This is only for CQ 5.5 and AEM 5.6 and not for AEM 6.x

Thanks,
Ratna Kumar.

Avatar

Community Advisor

Ratna Kumar wrote...

Hi Manikumar,

Yes there is one Helpx article which tells on compare content and import tool - to compare and import content differences from one CQ instance to another CQ instance.

Check here for the same: https://helpx.adobe.com/experience-manager/kb/contentcompareimport.html - This is only for CQ 5.5 and AEM 5.6 and not for AEM 6.x

Thanks,
Ratna Kumar.

 

I need this AEM 6.1 AEM instance.

Avatar

Administrator

Hi Mani

Please have a look at the details below:-

Link:-http://adobe-consulting-services.github.io/acs-aem-commons/features/jcr-checksum-compare.html

GitHub:-  ACS Adobe Experience Manager Commons GitHub page: “Quickly compares the contents of Adobe Experience Manager instances. JCR Compare computes checksums for specified node types (via an aggregated checksum of that node’s descendants) across multiple AEM instances and then compares the checksum results to identify what node (and node sub-systems) are the same or different.

How it works
You tell an AEM instance where it should find the instance to compare itself to, and define a number of useful comparisons to run, including based on a recursive path crawl, a JCR query, a list of known nodeTypes to include or exclude, and so on. It uses smart aggregate hashing to do the comparison and gives you the ability to drill into results to identify exactly what has changed.

Audience Impact (authors, devs, admins)

  • Devs – Allows them to see if they missed something in the migration or development phase
  • Authors – Allows them to verify what was changed between two environments
  • Admins – Allows them to quickly smoke test auto-scaled instances

 

JCR Compare via curl

To use the tool, do the following:

  1. HTTP GET /bin/acs-commons/jcr-compare.hashes.txt?path=/content/my-site where /content/my-site should be replaced with the path you want to generate hashes for. For example:curl -u admin:admin http://localhost:4502/bin/acs-commons/jcr-compare.hashes.txt?path=/content/my-site > hashes_pub1.txt
  2. Save the output to a file and sort the results using the sort command on a linux machine then diff them. For example:
cat hashes_pub1.txt | sort > hashes_pub1_sorted.txt cat hashes_pub2.txt | sort > hashes_pub2_sorted.txt diff hashes_pub1_sorted.txt hashes_pub2_sorted.txt

Once you know which paths are different then you can go to each server you retrieved a diff against and use theHTTP GET /bin/acs-commons/jcr-compare.dump.json servlet to get a dump of the content. For example here is how you would request this for a particular node:

curl -u admin:admin http://localhost:4502/bin/acs-commons/jcr-compare.dump.json?path=/content/my-site/en/jcr:content

Then you can use a JSON diff tool to visualize the differences: http://tlrobinson.net/projects/javascript-fun/jsondiff

 

I hope this would be helpful for you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Community Advisor

kautuksahni wrote...

Hi Mani

Please have a look at the details below:-

Link:-http://adobe-consulting-services.github.io/acs-aem-commons/features/jcr-checksum-compare.html

GitHub:-  ACS Adobe Experience Manager Commons GitHub page: “Quickly compares the contents of Adobe Experience Manager instances. JCR Compare computes checksums for specified node types (via an aggregated checksum of that node’s descendants) across multiple AEM instances and then compares the checksum results to identify what node (and node sub-systems) are the same or different.

How it works
You tell an AEM instance where it should find the instance to compare itself to, and define a number of useful comparisons to run, including based on a recursive path crawl, a JCR query, a list of known nodeTypes to include or exclude, and so on. It uses smart aggregate hashing to do the comparison and gives you the ability to drill into results to identify exactly what has changed.

Audience Impact (authors, devs, admins)

  • Devs – Allows them to see if they missed something in the migration or development phase
  • Authors – Allows them to verify what was changed between two environments
  • Admins – Allows them to quickly smoke test auto-scaled instances

 

JCR Compare via curl

To use the tool, do the following:

  1. HTTP GET /bin/acs-commons/jcr-compare.hashes.txt?path=/content/my-site where /content/my-site should be replaced with the path you want to generate hashes for. For example:curl -u admin:admin http://localhost:4502/bin/acs-commons/jcr-compare.hashes.txt?path=/content/my-site > hashes_pub1.txt
  2. Save the output to a file and sort the results using the sort command on a linux machine then diff them. For example:
cat hashes_pub1.txt | sort > hashes_pub1_sorted.txt cat hashes_pub2.txt | sort > hashes_pub2_sorted.txt diff hashes_pub1_sorted.txt hashes_pub2_sorted.txt

Once you know which paths are different then you can go to each server you retrieved a diff against and use theHTTP GET /bin/acs-commons/jcr-compare.dump.json servlet to get a dump of the content. For example here is how you would request this for a particular node:

curl -u admin:admin http://localhost:4502/bin/acs-commons/jcr-compare.dump.json?path=/content/my-site/en/jcr:content

Then you can use a JSON diff tool to visualize the differences: http://tlrobinson.net/projects/javascript-fun/jsondiff

 

I hope this would be helpful for you.

Thanks and Regards

Kautuk Sahni

 

 

 

Hi Sahni,

I tried in my local instances and it is taking so much of time to compare a single page we want very optimised time to compare so that this could be done on Production instances which is having lot of content

 

Thanks,

Mani Kumar K

Avatar

Administrator

I have asked internal team to look into this. I will share their response soon.

~kautuk



Kautuk Sahni

Avatar

Administrator

Hi 

There is no OOTB or readily available component/Tools for this use case, apart from some mentioned by me above.

But another option that you can do are:-

Option 1 :- Create a custom component to that access JCR node via JCR API programmatically and iterate all the child.

Here you can use the concept of comparing two trees (Link:- http://www.geeksforgeeks.org/write-c-code-to-determine-if-two-trees-are-identical/).

 

Option 2 :- USE FTP client to import all the site under root folder for both instances, and then compare it with and text comparison tool.

 

I hope this can also help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Community Advisor

Thanks for the above options and i will try to implement that for JCR comparisions but we one more usecase like extract metadata (name ,title and age etc.,) properties for whole project do we have any tool existing for this ?

 

Thanks

Mani Kumar K

Avatar

Administrator

Manikumar wrote...

Thanks for the above options and i will try to implement that for JCR comparisions but we one more usecase like extract metadata (name ,title and age etc.,) properties for whole project do we have any tool existing for this ?

 

Thanks

Mani Kumar K

 

If You can achieve this for JCR, this means you are able to achieve it for metadata as well.

Everything in AEM is stored as JCR (image, template, pages,Assets, metadata etc).

Go to :- /content/dam/geometrixx-media/articles/andrew-novokov.jpg/jcr:content/metadata in CRXDE for looking how metadata is stored.

If you want something specific that to only compare metadata then first do query to fetch metadata and then continue with your logic.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Community Advisor

Please refer to the JCR compare utility in ACS AEM commons: https://adobe-consulting-services.github.io/acs-aem-commons/features/jcr-compare/index.html

 

This is a useful tool for checking for content inconsistencies across AEM instances that would be otherwise difficult to find.


Aanchal Sikka